How to Batch Convert DOCX Files to TXT Format with textutil in Mac OS X

Feb 20, 2014 - 5 Comments

Batch convert docx to txt or rtf

The Mac includes a fantastic command line tool called textutil which allows for quick text file format conversions, translating almost any text or word document type into another. We’ve discussed textutil for a variety of uses, but typically it has been for one-off conversions of a specific file into a new file type. This time around we’ll focus on batch converting a group of files that are in the common Microsoft Office “DOCX” format, which is basically a compressed XML version of a classic Office DOC file, into a simple TXT or RTF file format, which has greater compatibility.

Because textutil is a command line tool, users should be somewhat comfortable using the terminal before diving in, this is reflected in the first examples shown for those who know the command line well enough. If you’re new, though we will try to make it easy enough that almost anyone at any skill level with Mac OS X should be able to follow along.

Batch Converting DOCX to TXT / RTF with textutil

For those who are adept at using the command line, the syntax necessary for batch docx to txt or rtf file conversion is as follows:

Batch converting docx files to txt with textutil

Convert DOCX to TXT:

textutil -convert txt /path/to/DOCX/files/*.docx

Convert .docx to .rtf :

textutil -convert rtf /path/to/docx/files/*.docx

The “-convert txt” or “-convert rtf” flag tells textutil to convert the files into the given format, and the rest of the command string is simply a path to the files in question. Then, a wildcard * is used with the .docx file extension to tell textutil to convert everything in that specified directory.

The freshly converted rtf or txt files will appear in the same directory as the original .docx files, the original dock files will not be overwritten or modified. That’s it, you’re all done. Obviously the txt file format is more universally readable than rtf, but RTF files maintain some formatting better than txt. Use whichever is necessary, or depending on the complexity of the docx files in question.

Batch Converting DOCX to TXT for Mac Terminal Newbies

If the above was over your head, don’t worry, you can make the process a bit easier by using a combination of the Finder and the Terminal, thanks to the print full path trick:

  1. Navigate in the Finder file system to the directory where the docx files are located which need to be converted, or drag the docx containing folder to the desktop
  2. Open the Terminal application, found in /Applications/Utilities/
  3. Type the following command syntax, adding a space at the end of ‘txt’, but don’t hit return yet:
  4. textutil -convert txt

  5. Go back to the Finder, now drag & drop the docx containing folder into the terminal window to print out the full directory path into the terminal
  6. Add at the end of the directory path “*.docx” without the quotes, the resulting command string at the terminal prompt should look something like this:
  7. textutil -convert txt ~/Desktop/MyDocxFiles/*.docx

  8. Hit return to complete the batch conversion

The new .txt files will appear almost instantly in the same folder as the original .docx files, they even have the same file name with the exception of the new file format extension. If you can’t tell the old file from the new files apart, be sure you have file format extensions set to visible in the Mac Finder to easily show the difference.

Batch converted docx to txt files in a Mac folder

Thanks to James Harvard for the tip idea.


Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks


» Comments RSS Feed

  1. sp says:

    i got a big document. it used to convert easily. then i changed the layout to two columns of text with some one-column-wide headings in between. now i get this:

    textutil -convert txt /Users/me/myProject/myBook.docx
    Error reading /Users/me/myProject/myBook.docx. The file isn’t in the correct format.

    what can i do to fix this or are there alternatives. thanks though.

  2. This is great! A real time saver!

  3. george says:

    awesome tip! Thanks a lot!!

  4. vdiv says:

    According to the manual it can convert any of the following formats:

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

    so docx conversion to rtf is probably interesting as well as it is supposed to preserve the formatting.

  5. esetlzn says:

    Good Tips

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site