Text tools

Word & character counter

Word & character counter. Runs entirely on your device, nothing is uploaded.

Runs on your device. The file is never uploaded.

Word & character counter prints six lines for a text file: characters with and without whitespace, words, lines, sentences, paragraphs and the UTF-8 byte total. A word is any run of non-whitespace and a character is a code point, not a UTF-16 unit. A sentence ends at a stop, bang or query mark, so abbreviations inflate that figure.

Input

Questions

How is a word counted?

As any run of non-whitespace characters. The counter matches every stretch of text between whitespace, so a hyphenated compound is one word, an ampersand on its own is one word, and a URL is one word. That is the same rule the wc command uses, and it will differ from a word processor, which usually applies its own dictionary-flavoured rules.

What counts as a character?

A Unicode code point, not a UTF-16 unit and not a byte. An emoji outside the Basic Multilingual Plane counts as one character even though JavaScript stores it as two units, while an emoji built from a joined sequence counts once per component. The report also gives a count with all whitespace excluded, and a separate UTF-8 byte count for the whole file.

How does it count sentences and paragraphs?

By punctuation and by blank lines. A sentence is a run of text ending in one or more of a full stop, question mark or exclamation mark, and empty runs are not counted. A paragraph is a block separated from the next by a blank line, again ignoring empty blocks. Abbreviations and decimal numbers therefore inflate the sentence count, since a full stop is a full stop.

Why is the byte count larger than the character count?

Because UTF-8 uses more than one byte for anything outside ASCII. An accented Latin letter takes two bytes, most CJK characters take three, and an emoji takes four. If the two numbers match, your file is pure ASCII. The byte figure is the one that matters for size limits; the character figure is the one that matters for people.

Does it modify or return my file?

No. The output is a plain report of six lines, characters, words, lines, sentences, paragraphs and UTF-8 bytes, and your file is left as it is. It runs per file, so a batch gives you one report per file, all computed in a Web Worker in this tab with nothing uploaded.

Related Text tools