Convert Between File Types Without an App, Part I

Sometimes, we find ourselves having to convert from one file type to another, and the app we have at hand, by Murphy’s Law, doesn’t have the particular conversion we want. Then, searching for a free, reliable app and learning how to do the conversion is a tedious process. Here’s how to do it without all that fuss.

Text Files

In this part I, I’ll discuss text files. All you need to do is open the Terminal app, found in /Applications/Utilities, and use a simple but handy command. The command is “textutil,” and it will convert back and forth between these file types:

txt, rtf, rtfd, doc, docx, odt, html, wordml, webarchive 

Here’s a simple version of the command:

textutil -convert output_format input_file_name

where output_format is one the strings in the first box above and input_file_name is the file you want to convert. A new file will be created in the same directory with the correct file type and the proper file name extension added.

Note, the simplest way to do this is navigate to the directory where the input file is. For example, if the input file is on your desktop, you have to navigate there with:

cd ./Desktop

For example, I have text file named “trial.txt” that I want to convert to rich text format. Here’s the command:

Terminal shot, textutil

The output is a new file named “trial.rtf.” There are many other options associated with this command, but to keep this short and simple, I’ll let you explore those on your own.  You can do that on the command line with:

man textutil

Just hit the spacebar to advance and type a “q” to escape. Amazingly, this command has been in OS X since Tiger.


I first ran across the need for this when I discovered that Apple’s TextEdit app will convert a RTF file to TXT but BBEdit will not. That’s because TextEdit speaks both RTF and TXT natively and has code to convert and RTF file to a simple text file, stripping away the markup.

On the other hand, BBEdit is a pure text editor and only knows how to deal with text files. If you import an RTF file, you’ll see the raw markup as ASCII, and there’s no function to strip away the markup and convert to a pure text file. Perfectly logical.

These little gotchas amongst all our apps mean that it’s often handy to bypass the technical decisions of the developer and have a command line tool that’s straight to the point.

I should note that a lot of shareware apps simply wrap a GUI around these command line tools and, perhaps, give you some of those extra options. Why pay for something when you can do it yourself very simply? And you won’t clutter up your Applications directory.

Finally, for users of legacy files, I am still investigating whether this command preserves the legacy Resource Fork. It’s something for users of very old files to be aware of, but not a concern for the rest of us.

In Part II, I’ll look at a similar utility for graphics files.