In this article, we're going to show you how to create a system-wide service that enables you to get an immediate word count and character count in TextEdit, Safari, Mail, or indeed any app on your Mac that lets you highlight text. It offers a handy home-made solution if you often find yourself pasting into a blank Word or Pages document for no other reason than to find out how many words are in a text selection.

word count automator service 2
The steps below will guide you through the process of creating your own word count service using the macOS Automator app. It's a simple procedure to follow and should only take five minutes, but if you'd rather use a third-party solution, then check out WordCounter, a free Mac menu bar utility from Onekerato.

How to Create a Word Count Service in Automator

  1. Launch Automator from the Applications folder.
    1 Automator

  2. Click New Document.

  3. Choose Service as the type of your document.
    2 Automator document type

  4. Type "run" into the Library search field at the top of the Automator sidebar, then drag the Run Shell Script action into the empty workflow area.
    automator drag shell script

  5. In the Run Shell Script action window, change the Pass Input: option to as arguments using the dropdown menu.
    automator run shell script

  6. Clear the text in the shell script box (highlight the text with your mouse cursor and hit Backspace) then copy and paste the following text into the same area:

    echo Words:

    echo $1 | wc -w

    echo Characters including spaces:

    echo $1 | wc -c
    automator word count script

  7. Clear the Library search field at the top of the Automator sidebar and type "set value", then drag the Set Value of Variable action into the workflow area.
    automator set value of variable

  8. Click the Variable: dropdown menu and select New Variable....

  9. In the blue dialog that appears, click inside the Name: input field. It may default to "storage", but you can rename it – we'll call it "count". Click Done, and you should now see "count" (or whichever name you used) appear in the variable list below the workflow area.
    automator variable name

  10. Clear the Library search field at the top of the Automator sidebar again, and this time type "ask", then drag the Ask for Confirmation action into the workflow area.
    drag ask for confirm

  11. Now, drag your "count" variable from the variable list up to the "Message" title in the Ask for Confirmation action.
    drag count variable

  12. In the Automator menu bar, select File -> Save..., call your new service "Word Count", and click Save.

Next time you want to get a word count and/or character count for some text you've highlighted, simply right-click (or Ctrl-click) on the text and select Services -> Word Count from the contextual dropdown menu.

word count
You can assign a key shortcut to it for even faster access. To do so, launch System Preferences, select the Keyboard pane, and click the Shortcuts tab. Select Services from the sidebar and you should find Word Count near the bottom of the list. Just click it, select Add Shortcut, and finally, enter your custom key combination.

word count shortcut

Top Rated Comments

TheralSadurns Avatar
48 months ago
Srsly guys... I don't think I'll need this. But you rock! Keep these guides and tutorials coming!!! They are MUCH appreciated!
Score: 11 Votes (Like | Disagree)
H2SO4 Avatar
48 months ago
Srsly guys... I don't think I'll need this. But you rock! Keep these guides and tutorials coming!!! They are MUCH appreciated!
Was gonna say exactly this till I saw your post. Reminds me of MacOXSHints.
[doublepost=1526030048][/doublepost]
Or get WordService for free from the App Store to give you text stats and so much more:
https://itunes.apple.com/app/wordservice/id899972312?mt=12
Maybe but this also teaches you stuff.
Score: 6 Votes (Like | Disagree)
IJ Reilly Avatar
48 months ago
Or get WordService for free from the App Store to give you text stats and so much more:
https://itunes.apple.com/app/wordservice/id899972312?mt=12
Beat me to it. I've used this indispensable collection of services for over 15 years. Can also be downloaded here:

https://www.macupdate.com/app/mac/10523/wordservice
[doublepost=1526061714][/doublepost]
Maybe but this also teaches you stuff.
I learned that I don't have to do it myself. ;)
Score: 2 Votes (Like | Disagree)
fairuz Avatar
48 months ago
Automator is one of the many amazing productivity features in macOS that few know about. It's saved me so much time.
Score: 2 Votes (Like | Disagree)
mingravity Avatar
48 months ago
Srsly guys... I don't think I'll need this. But you rock! Keep these guides and tutorials coming!!! They are MUCH appreciated!
absolutely !! very useful read
Score: 1 Votes (Like | Disagree)
MauiPa Avatar
48 months ago
Interesting, but all the text and code editors I use these days already have word and character counters built-in. Also, as stop-hammertime mentioned, if terminal commands aren't filtered, this script could execute code with unintended, or even dire consequences.
Padawan, perhaps it is the journey and not the destination.
Score: 1 Votes (Like | Disagree)

Popular Stories

airpodsinear 1

AirPods Save Woman's Life With Feature Everyone Should Know

Friday January 21, 2022 2:13 am PST by
Apple's AirPods have been credited with saving a woman's life after a potentially fatal fall, People reports. When a 60-year-old florist in New Jersey tripped and hit her head in her studio, she lost consciousness and awoke heavily bleeding. With nobody around to call for help, she realized she had her AirPods in, and used a "Hey Siri" command to call 911. An operator was able to stay on the ...
iphone 13 earpods

Apple to Stop Including EarPods With Every iPhone Sold in France From Next Week

Friday January 21, 2022 3:21 am PST by
Apple will no longer include EarPods with every iPhone sold in France, starting on January 24, according to a notice posted by a French carrier (via iGeneration). Apple was previously required to include EarPods in the box with the iPhone due to a French law that required every smartphone sold in the country to come with a "handsfree kit," but the law has now been changed in favor of reducing the ...
peloton tv workout cardio

Apple Floated as Potential Buyer of Peloton

Friday January 21, 2022 6:11 am PST by
Following months of bleak news about Peloton's "precarious state," including the revelation that it has halted production of its bikes and treadmills, Apple is being floated as a potential buyer of Peloton's troubled fitness business. Yesterday, CNBC reported that Peloton will temporarily stop production of its connected fitness products due to a "significant reduction" in consumer demand, a ...
Questionable Design Decisions

Apple's Most Questionable Design Decisions in Recent Memory

Sunday January 23, 2022 2:59 am PST by
Apple has always emphasized the depth of thought that goes into the design of its products. In the foreword to Designed by Apple in California, a photo book released by the company in 2016, Jony Ive explains how Apple strives "to define objects that appear effortless" and "so simple, coherent and inevitable that there could be no rational alternative." But every once in a while even Apple...
Spring 2022 Apple Products Feature

New iPad Air, Macs, and iPhone SE With 5G Likely to Be Announced at Apple Event This Spring

Thursday January 20, 2022 8:32 am PST by
Earlier this week, Bloomberg's Mark Gurman tweeted that Apple "will be holding a spring event" to announce a new iPhone SE and other hardware. In a recent edition of his newsletter, Gurman said the event is likely to occur in March or April. Gurman did not elaborate on what "other hardware" will be announced at Apple's purported spring event, but rumors suggest at least four products are...
Upcoming Products 2022 Feature

Gurman: Apple Preparing 'Widest Array of New Hardware Products in Its History' for Fall

Sunday January 23, 2022 10:32 am PST by
Apple is working on a number of new products that are set to launch this fall, and Bloomberg's Mark Gurman says that it will be "the widest array" of new devices that Apple has introduced in its history. In his latest "Power On" newsletter, Gurman explains that Apple is working on four new flagship iPhones (iPhone 14, iPhone 14 Max, iPhone 14 Pro, and iPhone 14 Pro Max), an updated low-end Ma...
apple watch series 7 aluminum colors yellowbg

Apple Watch Charging Bug Fixed in watchOS 8.4 Release Candidate

Thursday January 20, 2022 4:01 pm PST by
The watchOS 8.4 release candidate that was seeded to developers and beta testers this morning addresses an ongoing bug that could cause some Apple Watch chargers not to work properly with the Apple Watch. Back in December, we reported on a growing number of charging issues that Apple Watch Series 7 owners were facing. Since watchOS 8.3, there have been a number of complaints about...
safari icon blue banner

macOS Monterey 12.2 and iOS 15.3 Release Candidates Fix Safari Bug That Leaks Browsing Activity

Thursday January 20, 2022 1:30 pm PST by
The macOS Monterey 12.2 and iOS 15.3 release candidates that came out today appear to address a Safari bug that could cause your recent browsing history and details about your identity to be leaked to malicious entities. As shared last week by browser fingerprinting service FingerprintJS, there is an issue with the WebKit implementation of the IndexedDB JavaScript API. Any website that uses...
apple college discounts

Apple Walks Back UNiDAYS Verification Requirement for U.S. Education Store

Friday January 21, 2022 12:43 pm PST by
Earlier this week, Apple began requiring that customers taking advantage of educational discounts in the United States verify their status as a teacher, student, or school staff member through UNiDAYS. The requirement was a major change as Apple had never asked customers to go through a verification process in the United States before, and now, just three days after verification was added,...