TextEdit, the simple text editor program built into macOS (and Mac OS X before it), has many attractive qualities - so much so that this very article is currently being typed into it despite the presence of the far more fully featured Word and Pages on the same Mac. But it has one glaring limitation: there's no word count.

In this tutorial we walk you through a moderately simple method of adding a word count function to TextEdit on the Mac. Then we discuss some easier (if less satisfactory) workarounds you can try if the first one looks intimidating.

Create an exact word count in TextEdit

Open Automator. (It sits loose in Applications, or you can find it with Spotlight.) It will ask you to choose a type for your document; click Service, then Choose. (If it doesn't ask this, you may have to click New Document to get to the correct screen.)

At the top, leave the first bit (by 'Service receives selected') as 'text'. Click the second one (which says 'any application' by default) to open a dropdown menu, select Other, then find and select TextEdit.

How to do a word count in TextEdit on Mac: Automator

Make sure Library is selected in the lefthand pane (click Library in the top bar if this pane isn't showing) and scroll down until you find the action 'Run Shell Script' (it's in alphabetical order). Drag and drop this on the righthand pane.

How to do a word count in TextEdit on Mac: Automator

Don't change any of the other options. Just paste the following text (created by Tony T1 at this Apple discussion thread), exactly as it is, quote marks, strange filenames and all, into the text box, over the top of 'cat':

osascript <<-AppleScriptHereDoc
tell application "TextEdit"
set word_count to count words of document 1
set char_count to count characters of document 1
set show_words to (word_count as string) & " words. (" & (char_count as string) & " characters.)"
set dialog_title to "TextEdit Word Count"
display dialog show_words with icon 1 with title dialog_title buttons {"Ok"} default button "Ok"
end tell

Now click File > Save, and save the service as Word Count or similar. Quit Automator.

How to do a word count in TextEdit on Mac: Automator

And that's it! In a TextEdit document, select any bit of text (it doesn't work with no text selected) and right-click. The new command Word Count should have appeared at the bottom. (In High Sierra you'll have to select Services > Word Count.)

How to do a word count in TextEdit: High Sierra menu

Click this and you'll get a word count for the entire document (rather than for the text selected, so no, it's still not a perfect solution).

How to do a word count in TextEdit on Mac: Automator

Easier workarounds

If you're not keen on Automator, there are some simpler workarounds you can use instead.

Use TextEdit's Find function

This workaround is not exact, and again you can only use it to do a word count of the entire document, but at least it's something you do in TextEdit itself.

In your TextEdit document, hit Edit > Find > Find (or, more easily, Cmd + F) to open the Find field. Click the search icon (the magnifying glass) at the lefthand end of the field, and select Insert Pattern from the dropdown menu. In the second group of options you'll see 'Any Word Characters'. Click this.

How to do a word count in TextEdit on Mac: Find

The Find function will now run a search for any words at all. You'll see all of these words highlighted, and a number - the word count - at the righthand end of the Find field. The Word pattern remains in the Find field, so at any time you just have to hit Cmd + F to get another count. This becomes awkward if you need to find and replace something, however.

How to do a word count in TextEdit on Mac: Find

And a quick glance at the highlighted words will show that it isn't perfectly accurate, particularly falling down on words with apostrophes in. (On different occasions, for instance, depending on formatting, we've found that it thinks "you'll" is two words, or no words at all.) So it's fine for giving a rough idea, but it will consistently under- or overestimate by a few percent, depending on the casualness of your writing style.

Cheat! Paste into another program

Finally, and just in case it hadn't occurred to you already, let's very quickly mention the cheat method which most of us relied on before deciding to tackle this problem.

In the TextEdit document, select all (Cmd + A), or select the text you want to run a word count on, then go into a document in a program that does have a word count - we most often use Google Docs, but Microsoft Word and Apple Pages are other options - paste it in with Cmd + V and then do a word count there. (In Google Docs use Tools > Word Count, or Cmd + Shift + C.)

It's not satisfactory as solutions go but it does at least allow you to get a word count for selected text rather than for the entire document.