The short answer
The quickest way is an online tool: paste the text into the word counter and read the number. If you work in a document, every major word processor shows the count in the program.
| Where | How |
|---|---|
| Online | Word counter |
| Microsoft Word | Status bar at the bottom, or Review, Word Count. On Windows the shortcut is Ctrl+Shift+G |
| Google Docs | Tools, Word count, or Ctrl+Shift+C (Cmd+Shift+C on a Mac) |
| Pages | View, Show Word Count |
| Excel and Google Sheets | Formula that counts the spaces in a cell |
| Linux and macOS | wc -w file.txt |
| PowerShell | Get-Content file.txt | Measure-Object -Word |
Microsoft Word
The word count is shown in the status bar at the bottom left. Click it to open a box with pages, words, characters and lines, and an option to include or leave out text boxes, footnotes and endnotes. Select a passage first and the status bar shows the count of the selection as well as the whole document.
Google Docs
Choose Tools, then Word count. The box shows pages, words, characters with and without spaces, and it also has a setting to show the count while you type. It counts the selection if you select text first.
Pages and other programs
In Pages, choose View, then Show Word Count, and the count appears at the bottom of the document. Most editors have a similar status bar counter or an option in the menu, so look for Word count or Statistics.
Excel and Google Sheets
There is no built-in word count function, but you can count the spaces in a cell and add one:
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
This gives 1 for an empty cell, so wrap it in an IF test when cells can be empty:
=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1)
Command line
# Linux and macOS
wc -w file.txt
# PowerShell
(Get-Content file.txt | Measure-Object -Word).Words
In code
// JavaScript
const words = text.trim().split(/\s+/).filter(Boolean).length;
# Python
words = len(text.split())
// PHP
$words = count(preg_split('/\s+/u', trim($text), -1, PREG_SPLIT_NO_EMPTY));
In PHP, str_word_count is tempting but it can split words with accented letters, so the pattern above is safer for text in many languages.
Why different tools give different counts
- Hyphenated words. Most tools count well-known as one word, but some split it into two.
- Standalone symbols. A dash or an ampersand between spaces counts as a word in some programs and not in others.
- Slashes and em dashes. and/or and word—word are one word or two, depending on the tool.
- What is included. Footnotes, headers, text boxes and table cells may or may not be in the total.
- Languages without spaces. Chinese and Japanese need a rule of their own, often one word per character.
The word count tool shows the same text under four rules, so you can see how large the gap is.
Word count targets
If you are writing to a length, the essay word counter compares your count with a target and leaves out citations and references. To turn a word count into a time, use the reading time calculator or the speaking time calculator.
Related tools
Count characters, sentences, paragraphs or lines, check repeated terms with the keyword density checker, or read the guides to character counts, word frequency and counting lines.
Count your words now. Words, characters, sentences, reading time and more, as you type, in your browser.