Word Counter
Word Counter uses one Unicode regex whose allowed run contains letters, numbers, straight/curly apostrophes, and hyphens. It is not language-aware segmentation: punctuation-only runs made from apostrophes or hyphens can count, hyphenated compounds count as one, emoji are excluded, and scripts without spaces or language-specific clitics may not match editorial expectations.
Runs locally — files stay on your deviceDoes this use a dictionary or language model?
No.
A word count depends on tokenization rules
Different publishers and languages treat compounds, contractions, numbers, symbols, and punctuation differently; there is no single universal count.
How it works
trimmed input is matched globally against the shared character-class regex and the match-array length is returned.
Key concepts
Hyphen/apostrophe included
well-being and don't can each remain one token.
Emoji excluded
They are not letters or numbers in this regex.
When to use it
- Estimate words under this simple rule.
- Compare drafts processed by the same page.
- Feed its count into the paired reading-time heuristic.
When not to use it
- Do not use for contractual publishing limits without matching rules.
- Do not expect CJK segmentation.
- Do not assume punctuation-only tokens are excluded.
Worked examples
Simple
- Input
one two three- Expected output
3
Space separates runs.
Compound
- Input
well-being- Expected output
1
Hyphen is allowed.
Emoji
- Input
hello 😀- Expected output
1
Emoji is excluded.
Common mistakes
Comparing with another editor
Token rules differ. Correction: Use one agreed counter.
Assuming language segmentation
No locale logic exists. Correction: Use Intl.Segmenter or NLP.
Counting punctuation
Allowed punctuation runs can match. Correction: Review edge cases.
Best practices
- Document the counting rule.
- Test representative languages.
- Use one implementation for comparisons.
Related operations and differences
Add Prefix to Every Line
Choose Add Prefix to Every Line when you need to add the same prefix before every line.; use Word Counter specifically for count words.
Add Suffix to Every Line
Choose Add Suffix to Every Line when you need to add the same suffix after every line.; use Word Counter specifically for count words.
Capitalize Every Word
Choose Capitalize Every Word when you need to capitalize the first character of every word.; use Word Counter specifically for count words.
Extract Email Addresses
Choose Extract Email Addresses when you need to find unique email addresses in text.; use Word Counter specifically for count words.
Extract URLs
Choose Extract URLs when you need to find unique HTTP and HTTPS links in text.; use Word Counter specifically for count words.
Line Counter
Choose Line Counter when you need to count the number of text lines.; use Word Counter specifically for count words.
Limitations and privacy
- One regex tokenization; no locale/dictionary, CJK segmentation, punctuation validation, exclusions, stopwords, document parsing, or configurable rules.
The text is analyzed locally in this browser and is not uploaded by the tool.
Frequently asked questions
Are numbers counted?
Yes.
Are hyphenated terms one word?
Under this regex, usually yes.
Are emoji words?
No.
Can other counters differ?
Yes.