Need to convert a Word document into plain text, HTML or another format? Your Mac has a little trick hiding in Terminal, and you don't even need Microsoft Word installed.
There are plenty of reasons why you might need to convert a document from one format to another. Perhaps somebody has sent you a Word document, but all you need is the text. Maybe you're preparing some content for a website, archiving old notes or dealing with a collection of documents that need converting.
Normally, you'd open an application, import the document, choose a different format and save it again. That's fine for one file, but it can become rather tedious when you've got a folder full of them. Well, macOS has a built-in utility that can do the job without opening a document editor.
It's called textutil, and it's surprisingly handy.
Meet textutil
The textutil command is included with macOS and can convert between several document formats, including plain text, Rich Text Format (RTF), HTML and Microsoft Word documents.
To give it a try, open Terminal from Applications > Utilities and locate a Word document you want to convert.
For this example, we'll assume you've got a document called document.docx on your Desktop.
Enter the following command:
textutil -convert txt ~/Desktop/document.docxPress Return, and macOS will create a plain text version called document.txt alongside your original file.
No Word, no online converter and no additional downloads.
What about converting the other way?
Here's where things get interesting. textutil doesn't just extract text from Word documents; it can also create Word documents from other supported formats.
For example, if you've written something in a plain text file and need to turn it into a Word document, try:
textutil -convert docx ~/Desktop/document.txtYour Mac creates a .docx file that can be opened in Microsoft Word or another compatible word processor.
Of course, converting plain text into Word format won't magically add fancy headings, tables or page layouts, but for simple documents it does the job nicely.
Convert multiple documents at once
This is probably my favourite part.
Imagine you've got a folder containing twenty Word documents, and you need plain text versions of all of them.
Rather than opening each one individually, navigate to the folder in Terminal and enter:
textutil -convert txt *.docxThe asterisk tells Terminal to match every file ending in .docx in the current folder.
Each document is converted separately, saving a considerable amount of clicking around.
You can also use html instead of txt if you want to try converting a supported document into HTML.
A little word of warning
Document conversion isn't always perfect. Complex formatting, unusual fonts, images and complicated tables might not survive the process exactly as expected.
Plain text, in particular, strips away formatting entirely. For that reason, I'd recommend keeping your original documents and checking the results before sharing or publishing anything important.
I rather like discovering tools like this. They're not glamorous, and they're certainly not something Apple spends twenty minutes talking about during a keynote.
But they're genuinely useful, particularly when you're dealing with lots of documents or preparing material for a website.
