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
39 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
39 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
39 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
39 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
39 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
39 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)

Top Stories

prosser macbook air colors stacked

Images Reveal Colorful New MacBook Air Design

Tuesday May 11, 2021 5:06 am PDT by
Apple's next MacBook Air will feature a completely new design and come in a range of colors like the 24-inch iMac, according to leaker Jon Prosser, who has now released supposedly accurate renders of the new machines based on leaked images. In a new video uploaded to YouTube channel Front Page Tech, Prosser elaborated on his previous prediction that Apple's next-generation MacBook Air models ...
m1 ipad pro chip

M1 iPad Pro Over 50% Faster Than Previous Generation in Early Benchmarks

Tuesday May 11, 2021 11:56 am PDT by
Last month, Apple introduced a new iPad Pro with the same M1 chip found in the latest Macs, and early benchmark results indicate that the M1 iPad Pro is over 50% faster than the previous-generation iPad Pro. Based on five legitimate Geekbench 5 results (here's the fifth) for the fifth-generation 12.9-inch iPad Pro with the M1 chip, the device has average single-core and multi-core scores of...
iPhone 13 Camera Backs

iPhone 13 Models Will Be Slightly Thicker and Will Have Larger Camera Bumps

Monday May 10, 2021 10:41 am PDT by
Apple's upcoming iPhone 13 models will be slightly thicker than the iPhone 12 models and will also feature larger, thicker camera bumps with lenses that protrude less, according to iPhone 13 schematics seen by MacRumors. The new iPhone 13 and 13 Pro models are expected to feature a thickness of 7.57mm, up from 7.4mm in the iPhone 12 models. That's an increase of 0.17mm, which won't be hugely ...
apple park drone june 2018 2

Apple Fires Newly Hired Ex-Facebook Product Manager Following Revelations of Past Misogynistic Comments

Thursday May 13, 2021 12:10 am PDT by
Apple has fired Antonio García Martínez, an ex-Facebook product manager and author of the controversial book "Chaos Monkeys," following public and internal calls for removal and investigation due to past misogynistic statements, The Verge reports. Apple hired Martínez earlier this week to join its ads team, however, comments that Martínez made in the past sparked condemnation from users...
imac m1 blue isolated 16x9 500k

M1 iMac is Up to 56% Faster Than Prior-Generation High-End 21.5-Inch iMac

Wednesday May 12, 2021 10:03 am PDT by
Apple's M1 iMacs are set to start delivering to customers next week, and ahead of the official launch day, benchmarks for the machines have been showing up on Geekbench, likely from reviewers who are testing them. It will come as no surprise that M1 iMac benchmarks are right on par with benchmarks for the M1 MacBook Pro, MacBook Air, and Mac mini, coming in with an average single-core score...
iPad Pro Feature

Early M1 iPad Pro Orders Now Preparing to Ship

Tuesday May 11, 2021 9:41 am PDT by
Apple will soon ship out 11 and 12.9-inch M1 iPad Pro models, according to multiple Twitter users and MacRumors readers who have seen their orders shift to "Preparing to Ship" status. So far, we haven't seen any shipment notifications, but that's the next step and is likely to happen in the near future. Apple has not provided an exact delivery date to those who ordered a new M1 iPad Pro, but ...
fortnite apple logo 2

Judge in Epic vs. Apple Case Floats Potential Compromise

Wednesday May 12, 2021 3:54 pm PDT by
In the ongoing legal battle between Apple and Epic Games, the two companies are this week calling up their expert witnesses to argue their points before Judge Yvonne Gonzalez Rogers, who will make a decision in the case after a three week trial. Expert testimony is not as exciting as some of the leaked App Store documents that were highlighted last week, especially as much of what's being...
AirTag in Envelope Feature 2

AirTag Used to Successfully Track a Mailed Package Across the UK

Wednesday May 12, 2021 8:44 am PDT by
An Apple customer in the United Kingdom has successfully used Apple's Find My network to track an AirTag as it was being sent by mail to a friend in a completely different city. Outlined in a blog post at Intego, Kirk McElhearn said he taped an AirTag to a piece of card, wrapped it inside a small bubble envelope, and then sent it on its way. Kirk lives in the small town of...
maxresdefault

Video: Make Your iPhone Last Longer With These Battery Preserving Tips

Monday May 10, 2021 1:23 pm PDT by
Maximizing battery life is something that many iPhone users deal with on a regular basis as we all want our iPhones to last as long as possible. Sometimes there are bugs in iOS that make the battery drain faster, and sometimes we just need to eke out as much as possible on a long day out and about. Subscribe to the MacRumors YouTube channel for more videos. In our latest YouTube video, MacRumo...
macos big sur ios 14 iphone 12 pro macbook air icloud drive desktop documents hero

Apple Merging 'iCloud Documents and Data' Service With iCloud Drive in May 2022

Tuesday May 11, 2021 2:36 am PDT by
Apple plans to merge its iCloud Documents and Data service with iCloud Drive starting in May of 2022, according to a support document published late last week (via MacGeneration). iCloud Drive and iCloud Documents and Data share the fundamental ability to backup data from apps. However, iCloud Documents and Data was often a cumbersome, confusing experience. In contrast, iCloud Drive is more...