# Word Frequency Counter

URL: https://hifreetools.com/text/word-frequency-counter

> Paste any text to see a ranked table of how many times each word appears, along with the percentage each word represents of the total. Optionally strip common stop words like "the" and "and" to surface the keywords that matter. Everything runs locally in your browser.

## Quick answer

A word frequency counter tokenizes your text on word boundaries, lowercases each word so capitalization is ignored, tallies the occurrences in a map, then ranks words from most to least frequent. Each word's percentage is its count divided by the total word count, and an optional stop-word filter removes common function words like "the", "and", and "of".

## Formula

- Tokenization rule: words = lowercase(text) split on any run of non-word characters, keeping inner apostrophes (Unicode letters, digits, and ' inside a word)
- Frequency percentage: percent(w) = ( count(w) / total ) x 100
- Ranking rule: sort by count descending, then by word alphabetically ascending for ties

Type or paste text into the box. The tool lowercases everything, then splits it into words of letters (any alphabet, accents included) and digits, keeping inner apostrophes (so "it's" stays one token) while treating punctuation, spaces, and line breaks as separators. Chinese, Japanese and Thai text, which has no spaces between words, is split with your browser's built-in word segmentation. Each distinct word is tallied in a Map, and the totals are sorted in descending order of count, with alphabetical ordering breaking ties so the ranking is stable. For every word, the percentage shown is count divided by the total number of counted words, times 100, rounded to one decimal place. Turn on "Remove common stop words" to drop a built-in list of high-frequency function words before counting (English on this page; the Spanish, French, German, Portuguese, Italian and Russian pages use a short list for their language, and other languages have no stop-word option); when enabled, both the totals and the percentages are recomputed over only the remaining words. Results update instantly as you type, and you can copy the ranked table with one click.

## Examples

- Repeated words and percentages: The cat sat on the mat. The cat ran. → 1. the — 3 (33.3%) 2. cat — 2 (22.2%) 3. mat — 1 (11.1%) 4. on — 1 (11.1%) 5. ran — 1 (11.1%) 6. sat — 1 (11.1%)
- Stop-word removal on: The quick brown fox and the lazy dog → 1. brown — 1 (20.0%) 2. dog — 1 (20.0%) 3. fox — 1 (20.0%) 4. lazy — 1 (20.0%) 5. quick — 1 (20.0%)
- Case-insensitive counting: Go go GO stop → 1. go — 3 (75.0%) 2. stop — 1 (25.0%)

## FAQ

**How does the tool decide what counts as a word?**
It lowercases the text and splits on any run of non-word characters, keeping letters of any alphabet (accented ones too), digits, and apostrophes inside a word. So "it's" and "café" are one word each, but spaces, line breaks, commas, periods, and hyphens act as separators. Chinese, Japanese and Thai text is split by your browser's word segmentation.

**Is the counting case-sensitive?**
No. Every word is lowercased before it is tallied, so "The", "the", and "THE" are treated as the same word and combined into a single row in the ranking.

**What are stop words and what happens when I remove them?**
Stop words are very common function words such as "the", "and", "of", "to", and "is" that carry little topical meaning. When you enable removal, they are dropped before counting, and both the total and every percentage are recomputed over the words that remain, which surfaces your real keywords.

**How is each word's percentage calculated?**
Percentage equals the word's count divided by the total number of counted words, multiplied by 100 and rounded to one decimal place. If stop-word removal is on, the total is the count of the remaining words, so percentages reflect only the filtered text.

**How are ties in the ranking ordered?**
Words are sorted by count from highest to lowest. When two or more words share the same count, they are ordered alphabetically so the table is stable and predictable every time you run the same text.

**Is my text uploaded anywhere?**
No. All tokenizing, counting, and sorting happen entirely in your browser using JavaScript. Your text never leaves your device and nothing is sent to a server.

**Does it count numbers as words?**
Yes. Standalone numbers and alphanumeric tokens like "2024" or "v2" are treated as words and included in the frequency table, since they match the word pattern of letters and digits.


## Sources

- [MDN: String.prototype.match()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
- [MDN: Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
- [Wikipedia: Stop word](https://en.wikipedia.org/wiki/Stop_word)
- [MDN: Intl.Segmenter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Word Frequency Counter", https://hifreetools.com/text/word-frequency-counter
