Letter Frequency Analyzer - Character Frequency Counter
Analyze letter and character frequency distribution, entropy, and patterns in any text instantly.
Updated
What is the Letter Frequency Analyzer - Character Frequency Counter?
A Letter Frequency Analyzer counts how often selected characters or n-grams appear in text and displays their counts and percentages. It can also calculate Shannon entropy and the Index of Coincidence (IoC), two statistics used in information theory and introductory cipher analysis.
Use it to explore character patterns in writing, classroom exercises, or simple substitution-cipher puzzles. These statistics are descriptive and do not identify a language or determine whether text is secure.
What You Can Analyze
- Single letters (A-Z) with case-sensitive or case-insensitive modes
- Selected characters such as digits, spaces, newlines, punctuation, and Unicode symbols
- N-grams: bigrams (th, he), trigrams (the, and), 4-grams and 5-grams for deeper pattern detection
- Custom filters to include only what you need
Why Frequency Analysis Matters
- Improve writing: Spot overused letters, balance vocabulary, and check readability
- Break ciphers: Classic frequency analysis is the foundation of substitution cipher cryptanalysis — E, T, A, O, I, N should dominate English text
- Pattern exploration: Compare distributions in sample text or simple ciphers
Key Features
- Live histogram with percentage and count, sorted by frequency, alphabet, or appearance
- Shannon entropy (bits) and Index of Coincidence (IoC) calculated automatically
- English expected frequency overlay (E 12.7%, T 9.06%, etc.) to compare your text vs. natural English
- Searchable frequency table with Unicode code points (U+0041) and readable display names for whitespace
- One-click export to CSV and JSON, copy list, and downloadable reports
- Unicode code points are counted individually; a visible symbol made from multiple code points may count more than once
- Analysis runs in your browser
Whether you are exploring a cryptogram or reviewing writing, the analyzer provides a quick view of the selected character distribution.
How it works
The tool runs entirely client-side in four deterministic steps: tokenize, filter, count, and visualize.
1. Tokenization (Unicode-Safe)
Input is split with Array.from(text) so Unicode code points such as a basic emoji are not split into surrogate halves. A visible character made from multiple code points, such as an emoji with a skin-tone modifier, can still count as more than one token.
If you select an n-gram size > 1, the tool first filters the stream, then slides a window of size N:
filtered = bigrams = th, he, eq, qu, ui, ic, ck[t][h][e][q][u][i][c][k]
2. Filtering & Normalization
A preset determines what to keep:
- Letters only:
\p{L}(any Unicode letter) - Alphanumeric: letters +
\p{N}(numbers) - All characters: letters, digits, spaces, newlines, punctuation
\p{P}and symbols\p{S} - Custom: you toggle each category
Additional options:
- Case insensitive:
toLocaleLowerCase()is applied before counting, soAandamerge - Unicode toggle OFF: non-ASCII characters are dropped (ASCII-only mode)
3. Counting & Statistics
Counting uses a Map<string, {count, firstIndex}> for O(n) performance.
For each unique token:
- Percentage =
count / total * 100 - Bar width =
count / maxCount * 100(relative to most frequent)
Global metrics:
- Entropy (Shannon):
-Σ p * log₂(p)— describes how concentrated or spread out the selected token distribution is. - Index of Coincidence (IoC):
Σ count*(count-1) / total*(total-1)— a character-distribution statistic sometimes used when exploring classical ciphers. Its interpretation depends on the text and filters used.
Most and least frequent tokens are tracked independently of sort order.
4. Sorting, Comparison & Export
You can sort by:
- Frequency (high → low, tie-break alphabetical)
- Alphabetical (
localeCompare) - Appearance (first occurrence index)
If English reference is enabled in Letters only + 1-gram mode, the tool compares your percentages with a reference set of typical English letter frequencies. Results vary with the text and are not a language detector.
All data stays in memory. Export builds CSV with proper quoting and JSON with total, unique, generatedAt, and entries — ready for spreadsheets or code.
No network request is made at any step.
Examples
Pangram Letter Frequency
Analyze a classic pangram to see how evenly letters are distributed.
The quick brown fox jumps over the lazy dogTotal: 35 letters, Unique: 26, Most frequent: o (4 times, 11.43%), Entropy: 4.54 bits, IoC: 0.021Cipher Text Analysis
Check frequency patterns in encrypted text to identify substitution ciphers.
WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJTotal: 35 letters, Most frequent: K, H, R (8.57% each), IoC: 0.042, English reference comparison shows deviation from ETAOIN patternBigram Writing Style Analysis
Analyze common letter pairs to study writing style and language patterns.
frequency analysis helps improve writing clarityBigrams total: 41, Top: re (3), en (2), im (2), Most frequent bigram: re (7.32%), Useful for authorship and readability analysisFull Character Distribution
Count everything including spaces, digits and punctuation for complete statistics.
Hello, World! 123Total counted: 16 characters, Letters: 10, Digits: 3, Spaces: 2, Punctuation: 1, Most frequent: l (3 times, 18.75%)Frequently asked questions
What is a letter frequency analyzer?
What is a letter frequency analyzer?
A letter frequency analyzer counts how many times each character or letter appears in a text and converts the counts into percentages and visual charts. It is used for writing analysis, linguistics, education, and cryptanalysis to understand distribution patterns like which letters dominate English (E, T, A, O, I, N).
How is the frequency percentage calculated?
How is the frequency percentage calculated?
Percentage is calculated as count / total counted tokens * 100. For example, if e appears 12 times out of 100 filtered letters, its frequency is 12%. When you use bigrams or enable filters, the total is the number of tokens after filtering, not the raw input length. Bar width is relative to the most frequent token.
What is the difference between case-sensitive and case-insensitive modes?
What is the difference between case-sensitive and case-insensitive modes?
In case-insensitive mode (default), A and a are merged using toLocaleLowerCase() before counting, giving you the classic A-Z distribution. In case-sensitive mode, uppercase and lowercase are counted separately, which is useful for analyzing code, passwords, or stylized text where case carries meaning.
What do entropy and Index of Coincidence (IoC) mean?
What do entropy and Index of Coincidence (IoC) mean?
Shannon Entropy in bits describes how concentrated or spread out a token distribution is: -Σ p·log₂(p). Index of Coincidence estimates the chance that two randomly selected tokens match. Both values depend on the text and filters; they can be used to explore patterns but do not establish whether text is encrypted.
Can this tool handle Unicode, emojis, and non-English text?
Can this tool handle Unicode, emojis, and non-English text?
The tool can include Unicode letters, numbers, and symbols. It counts code points, not necessarily whole visible characters, so combined emoji or letters with separate accent marks may appear as multiple tokens. Turn off Unicode: on to restrict analysis to ASCII. Display names like ␣ SPACE and ↵ LF make whitespace visible.
What are n-grams, bigrams, and trigrams?
What are n-grams, bigrams, and trigrams?
An n-gram is a sequence of N adjacent tokens. 1-gram = one token, bigram = 2 tokens like th, trigram = 3 tokens like the. N-grams can help compare patterns in text or explore simple ciphers. The tool builds them after filtering, so spaces are excluded unless you include them.
How can I use this for breaking substitution ciphers?
How can I use this for breaking substitution ciphers?
For a simple substitution-cipher exercise, compare the ciphertext's letter distribution with the English reference. A frequent cipher letter might correspond to a frequent English letter, but frequency alone cannot reliably identify the mapping or decrypt text.
Is my text private? Do you store or send it?
Is my text private? Do you store or send it?
Analysis and export are handled in your browser; the tool does not send the text for analysis.
Related tools
More utilities you might find handy.
Anagram Checker
Check if two strings are anagrams with customizable normalization options.
Case Converter
Convert text to various cases like uppercase, lowercase, title case, camelCase, snake_case, and more, with additional text cleaning features.
Find & Replace Tool
Find and replace text instantly online with regex, whole word, case matching, preserve case, and batch rules. 100% client-side.