MainspringGuides › textutil
macOS Guide

Convert Documents From Terminal With textutil

Updated July 2026 · 3 min read

Someone sends you a .docx and you need plain text. Or you have forty RTF files that should be HTML. The reflex is to hunt for a converter website — but your Mac ships one: textutil, a document converter that handles Word, HTML, RTF, and plain text locally, in batches, with nothing uploaded anywhere.

Convert one file

# Word document to plain text
textutil -convert txt report.docx

# plain text to Word
textutil -convert docx notes.txt

The converted file appears next to the original with the new extension — report.docx stays untouched and report.txt is created beside it. That's the built-in safety: since originals are never modified, undoing a conversion is just deleting the new file. The formats -convert accepts: txt, rtf, rtfd, html, doc, docx, odt, wordml, and webarchive.

Notably absent: PDF. textutil reads and writes editable document formats only — for PDF output, open the file and use Print → Save as PDF, or Pages/Preview.

Batch conversions

This is where it beats any website. Wildcards convert a whole folder in one line:

# every Word file in this folder → plain text
textutil -convert txt *.docx

# control where results go
textutil -convert html *.docx -extension htm

Each input gets its own output file alongside it. Useful companions: -output name.txt picks an exact output filename (applies to the first file), and -extension htm changes the extension on all outputs. Converting an old folder of .doc files to .docx, or a documentation set from RTF to HTML, is exactly this one command plus a wildcard.

Merge files with -cat

textutil can also concatenate documents into one — even mixed formats:

# stitch chapters into a single Word file
textutil -cat docx chapter1.docx chapter2.docx chapter3.docx -output book.docx

# combine text notes into one RTF
textutil -cat rtf *.txt -output combined.rtf

Files are appended in the order given (shell wildcards expand alphabetically — name files 01-, 02-… if order matters). Formatting is preserved as well as the target format allows. Without -output, the merged result lands in a file named out with the format's extension, so it's worth always specifying one.

Inspect before you convert

# what is this file, really?
textutil -info mystery.doc

-info prints the file's actual type, size, and — for documents with metadata — author and modification dates. It's the quick answer when an emailed "doc" turns out to be RTF wearing the wrong extension, which is also the usual culprit when a conversion produces garbled output.

Two limitations to expect: complex Word layouts (text boxes, tracked changes, embedded objects) simplify in translation, and images survive only in formats that hold them — converting to txt keeps just the text, while rtfd and html keep attachments. For a quick "get me the words out of this file," those trade-offs are exactly right.

Pipe it like any Unix tool

# read a Word file's text without creating any file
textutil -convert txt -stdout report.docx | less

# count the words in a docx
textutil -convert txt -stdout report.docx | wc -w

-stdout sends the converted result to standard output instead of a file, which turns any document into greppable text mid-pipeline: search a folder of Word files with a loop and grep, feed a docx to a script that expects plain text, or preview a conversion before committing to it. There's a matching -stdin for the reverse direction. It's the difference between a converter and a proper citizen of the shell.

Built-in beats uploaded

Your Mac quietly ships dozens of capabilities like this. Mainspring surfaces the settings half — 90+ hidden macOS tweaks as labelled, reversible toggles.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

The image-side sibling

textutil's counterpart for pictures is sips — batch resizing and format conversion with the same no-upload convenience. Our guide to sips covers it.