Guide

How Word Count Is Calculated

A word count seems simple: count the words. But a computer has to decide what a word is, and text is full of edge cases such as hyphens, apostrophes, numbers, abbreviations, web addresses and non-English scripts. This guide explains the method used by WordCounter.pk and how it compares to other programs.

Updated

Short answer: The counter splits text into tokens made of letters and numbers, keeping apostrophes, hyphens and internal punctuation such as the dots in “U.S.A.” inside a token. Each token that contains a letter or number counts as one word.

Step 1: clean the text

Before counting, invisible characters such as zero-width joiners are removed so that they do not split words. This matters especially for Urdu and other right-to-left scripts, where such joiners are used to control how letters connect. Line breaks and tabs are treated as spaces between words.

Step 2: tokenise

The tokenizer reads the text and extracts runs of Unicode letters, combining marks and digits. A run may be joined to the next by a single apostrophe, hyphen or one of the common internal connectors: full stop, comma, colon, slash, at-sign, underscore and percent sign, but only when another letter or digit follows. This design means “don’t”, “well-known”, “3.14”, “1,250”, “U.S.A.”, “10:30” and “www.example.com” are each one word. A token must contain at least one letter or digit, so a lone dash, bullet or emoji is not a word.

Examples

TextWords countedWhy
don’t1Apostrophe inside a word
well-known1 (2 if hyphens split)Hyphen joins letters; optional setting
20261Numbers are words
1,2501Comma between digits
3.141Decimal point between digits
U.S.A.1Dots between letters
www.example.com1Dots between letters
and/or1Slash between letters
word—word (em dash)2An em dash is not a connector
— (alone)0No letter or digit
😀0Emoji are counted separately
اردو متن2Unicode letters, any script

Two options on the main counter, Hyphen = 2 words and Skip numbers, let you match a rulebook that differs. See Do Hyphenated Words Count as One or Two? and Do Numbers Count as Words?.

Characters are counted as Unicode code points, with and without whitespace. Sentences are found by splitting at . ! ? … and the Urdu ۔ and ؟ when followed by a space or the end of text, and at line breaks. Paragraphs are blocks separated by blank lines. Reading time divides words by 238 and speaking time by 130, as explained in How Reading Time Is Calculated.

Why counters disagree

Microsoft Word, Google Docs and online tools each make slightly different choices. Word splits strictly on spaces, so “word—word” without spaces is one word in Word. Google Docs treats an em dash as a separator. A tool that counts every run of letters would split “U.S.A.” into three. Over a 5,000-word document, these differences usually amount to a handful of words. If a portal has its own counter, its figure is final; see How Microsoft Word Counts Words and How Google Docs Counts Words for those programs.

Try it yourself

Put the numbers above to work with these free tools:

Frequently asked questions

Are numbers counted as words?

Yes. See Do Numbers Count as Words?.

Are URLs one word?

Yes, as long as they contain no spaces.

Is there an official definition of a word for word counts?

No. Each program defines its own, which is why totals can differ slightly.