Back to Utilities

Text Statistics

Count words, characters, lines, paragraphs, bytes, and reading time.

Advertisement
Loading...

What this tool does

Text statistics provide a quick overview of the length, complexity, and readability of a piece of writing. This tool counts words, characters (with and without spaces), lines, paragraphs, sentences, and bytes, plus estimates reading time based on the average adult reading speed of 200-250 words per minute.

The word counter uses Unicode-aware tokenization to handle CJK (Chinese, Japanese, Korean) characters, accented Latin characters, and emoji correctly. Sentence detection uses simple heuristics (period, question mark, exclamation followed by whitespace and capital) that work for most Western languages but may undercount in CJK text where there is no whitespace between words.

Usage Example

// Count words
const text = "Hello, world! How are you?";
text.split(/\s+/).filter(Boolean).length;
// 5 words

// Count characters (including spaces)
text.length;  // 26

// Count characters (excluding spaces)
text.replace(/\s/g, "").length;  // 21

// Count bytes (UTF-8)
new TextEncoder().encode(text).length;  // 26

Common Edge Cases

  • CJK text has no spaces between words, so word counting by whitespace produces 1 word per sentence. For accurate counts, use a CJK-aware tokenizer like Intl.Segmenter.
  • Emoji can be composed of multiple Unicode code points (e.g., flag emojis use two regional indicators). Character counts by codepoint differ from visual character counts.
  • Trailing and leading whitespace affect word counts if not stripped. Most tools strip whitespace before counting, but be aware of the convention.
  • Reading time estimates assume an average speed of 200-250 words per minute. Technical content with code, equations, or diagrams takes significantly longer.
  • Paragraph counting is ambiguous: does a single line break count as a paragraph break, or do you need two consecutive line breaks? Most tools use the double-line-break convention.

FAQ

How accurate is the reading time estimate?
It assumes 200-250 words per minute, which is the average for adult readers of English prose. Technical content, code, and non-English languages will have different rates. Treat the estimate as a rough guide, not a precise measurement.
Why does my character count differ from other tools?
Different tools count different things: some count code points, some count grapheme clusters, some count UTF-16 code units (JavaScript strings), and some count bytes. Always check the tool documentation for the specific definition.
How do I count words in Chinese or Japanese text?
Use a CJK-aware tokenizer. The browser Intl.Segmenter API with locale 'zh' or 'ja' provides accurate word segmentation. Simple whitespace splitting will dramatically undercount CJK text.
Advertisement