BLOG / GUIDE · 2026-05-03 · 7 min

How to count words in any text

Six ways to count words — Word's Word Count dialog, Excel/Sheets formulas, Notepad++, VS Code extensions, wc -w, or a browser tool that shows five stats at once.

The short answer. Paste your text into the line counter — you'll see the word count alongside line, character, blank-line, and non-blank-line stats, all updated live. In Microsoft Word, Review → Word Count. In Excel, the formula =LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1 counts words in a cell. In Google Sheets, the same formula or =COUNTA(SPLIT(A1," ")). On the command line, wc -w file.txt. The catch: tools disagree on edge cases like contractions, hyphenated words, and numbers — the gap is usually small but matters for tight word limits. The table at the bottom maps your situation to the right method.

What counts as a word, anyway?

Two definitions, and the gap between them gets bigger the messier the text is:

  • Whitespace-separated tokens. The simplest and most common rule: anything between whitespace runs counts as one word. "isn't" = 1 word. "isn't it cool" = 3 words. Used by wc -w, the joinlines counter, most basic counters.
  • Linguistic words. A "real" word in the language sense — contractions might count as two ("is" + "n't"), hyphenated terms might count separately. Used by some academic tools and a few writing apps; rarely the default.

Microsoft Word sits somewhere in the middle, with rules that have shifted across versions. The practical answer: pick one tool for the whole document and trust its count. Mixing counts from different tools creates noticeable gaps on the same text.

How do you count words online, instantly?

Open the line counter. Paste your text. The Words row updates live alongside four other stats:

  • TOTAL LINES — logical line count (every \n-bounded segment, including the last line whether or not it ends with a newline).
  • NON-BLANK — lines with at least one non-whitespace character.
  • BLANK — lines that are empty or whitespace-only.
  • WORDS — whitespace-separated tokens. "isn't" = 1 word; punctuation sticks to its neighbour. We rebuilt this rule three times before settling on the whitespace-split version — it matches what most users intuitively expect.
  • CHARACTERS — raw input length, including line breaks. Most emoji count as 2 (JavaScript string length).

Nothing uploads. The whole count is a few String.split() calls in the page — verifiable in DevTools → Network, where you'll see zero outbound requests after page load.

How do you count words in Microsoft Word?

Word has the most polished word-counting UI of any tool here.

  1. Click the Review tab.
  2. In the Proofing group, click Word Count.
  3. The dialog shows pages, words, characters (separately with and without spaces), paragraphs, and lines — in roughly that order.

For a running count while you type, look at the bottom status bar: Word displays "Words: N" or "N of M" when you have text selected. Right-click the status bar to toggle which stats it shows.

Word counts contractions as one word and footnotes / headers / textboxes separately — the Word Count dialog has checkboxes to include them or not. Honest note: Word's count is the de facto authority for academic submissions, journalism word limits, and most professional writing — not because its rule is "right", but because the editor / publisher / professor is using the same tool.

How do you count words in Excel?

Excel has no built-in word-count function. The standard formula:

=LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1

What it does: trims leading/trailing whitespace, measures the length, then subtracts the length with all spaces removed. The difference is the number of spaces; add 1 for the word count. Works on a single cell.

A subtle bug: a cell with only whitespace returns 1 (treated as one "word"). To handle this:

=IF(LEN(TRIM(A1))=0, 0, LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)

To count words across a whole column:

=SUMPRODUCT((LEN(TRIM(A1:A100))-LEN(SUBSTITUTE(A1:A100," ",""))+1)*(LEN(TRIM(A1:A100))>0))

Slightly hairy. For a one-off count of many cells, often the fastest path is to copy the column into Word and use Word Count.

How do you count words in Google Sheets?

The Excel formula works identically. Sheets also has a cleaner option:

=COUNTA(SPLIT(A1," "))

Splits the cell on spaces and counts the non-empty pieces. For a whole column:

=SUMPRODUCT(LEN(TRIM(A1:A100))-LEN(SUBSTITUTE(A1:A100," ",""))+1)

Same caveat as Excel: a whitespace-only cell returns 1; wrap in an IF if that matters.

How do you count words in Notepad++ or VS Code?

Both editors expose line-level stats more readily than word stats; word counting is a secondary feature.

Notepad++

  • View → Summary… opens a modal dialog with character count, word count, line count, and a few other stats — for the whole file (selection scope depends on version).
  • The status bar at the bottom shows length and line count, but not a live word count.

VS Code

  • The status bar shows the selection's character count when text is selected, but no built-in word count.
  • Install the popular Word Count extension by Microsoft for a live status-bar word count, or the more featureful Markdown All in One extension if you write Markdown.

For one-off counts on plain ASCII English text, either editor's Find dialog with a regex like \b\w+\b in Find All gives you the match count. The two editors' regex engines treat \w with Unicode differently, so for non-ASCII text the count will diverge — use a dedicated word counter for accuracy.

How do you count words on the command line?

The Unix one-word answer is wc (word count).

wc -w file.txt

Counts whitespace-separated tokens. Variants:

  • wc -w file.txt — word count only.
  • wc file.txt — three columns: lines, words, characters / bytes.
  • wc -w *.txt — per-file word counts plus a total.
  • echo "isn't it cool" | wc -w — pipe text directly without a file.

For a count of distinct words (vocabulary size):

tr -s '[:space:]' '\n' < file.txt | sort -u | wc -l

Splits whitespace to newlines, sorts, dedupes, counts. Add tr 'A-Z' 'a-z' | in the middle for a case-insensitive vocabulary count.

On Windows in PowerShell:

(Get-Content file.txt | Measure-Object -Word).Words

Which method should you use?

What you're counting words forBest method
One-off paste from anywhereBrowser tool (gives 5 stats at once)
Academic / journalism word limitMicrosoft Word's Word Count — the de facto authority
One Excel cell=LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1
One Google Sheets cell=COUNTA(SPLIT(A1," "))
Whole text file on diskwc -w file.txt
Many files at oncewc -w *.txt
SEO content draft / social media postBrowser tool — matches the simple whitespace-split rule most platforms use
Vocabulary size (unique words)tr -s '[:space:]' '\n' < file.txt | sort -u | wc -l

Frequently asked questions

Why does Word say 200 but my browser tool says 195?

Different tokenisers. Word treats some compound constructs (hyphenated words, em-dash-separated phrases) differently from a pure whitespace split. A small gap is normal across tools. If a precise count matters (a 500-word limit, for example), pick the tool the reader will use to verify — if it's an editor on Word, use Word's count.

Does the count include numbers as words?

Every tool on this page does, yes. "In 2026 we have 8 tools" = 6 words, regardless of which counter you use. Tools that exclude numbers from word counts exist (some linguistic-analysis tools), but they're specialised; the defaults always include numbers.

How do I count words in many short cells in a spreadsheet?

The single-cell formula filled down a helper column, then summed:

// In B1, filled down:
=IF(LEN(TRIM(A1))=0, 0, LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)
// Then in another cell:
=SUM(B:B)

Cleaner than nesting SUMPRODUCT for messy data and lets you spot per-row outliers.

How do I count words while excluding markup or code blocks?

Plain word counters don't distinguish. For Markdown with code blocks, strip code first: sed '/^```/,/^```/d' draft.md | wc -w — deletes everything between fence markers, then counts. For HTML, strip tags: sed 's/<[^>]*>//g' page.html | wc -w — rough but workable for a back-of-the-envelope count.

What's the fastest way to count words in a 1 GB log file?

Terminal, no contest. wc -w big.log streams the file byte by byte; no memory ceiling. Excel and Word will refuse to open the file. Browser tools accept the paste in principle, but at that size the clipboard step itself becomes the bottleneck before the counter does.

Is it safe to paste a sensitive draft into an online word counter?

Only if the tool runs entirely in the browser. Open DevTools, switch to the Network tab, paste, watch for outbound requests. If any carry your text, the page sent it to a server. The joinlines counter makes zero requests after page load — verifiable in DevTools.

— the joinlines team, 2026-05-03

§ — PRIVACY Your text never leaves your browser. No upload, no account, no logs on what you paste.
PRIVACY PAGE ↗