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 each letter, character, or n-gram appears in your text and visualizes the distribution. Paste any text to get live percentages, bar charts, entropy, and Index of Coincidence — all computed 100% in your browser.
Perfect for writers, students, linguists, puzzle solvers, and cybersecurity learners who need fast, accurate text statistics without uploading data anywhere.
What You Can Analyze
- Single letters (A-Z) with case-sensitive or case-insensitive modes
- All characters including digits, spaces, newlines, punctuation, and Unicode / emoji
- 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
- Language detection: Entropy and IoC reveal if text is random, compressed, or natural language
- Data validation: Detect anomalies, hidden patterns, or biased random generators
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-correct counting via
Array.from()— emojis and accented characters count as one - Private by design: no server calls, no storage, works offline
Whether you are solving a cryptogram, teaching linguistics, auditing passwords, or polishing prose, this analyzer gives you the complete letter distribution picture in milliseconds.
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) instead of text.split('') so surrogate pairs and graphemes like é or 😀 are counted as single characters.
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: characters with code point > 127 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)— higher means more randomness. English text is ~4.0–4.5 bits per letter, random text approaches log₂(unique). - Index of Coincidence (IoC):
Σ count*(count-1) / total*(total-1)— English is ~0.0667, random text ~0.0385. Useful to detect ciphers and language.
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 and you are in Letters only + 1-gram mode, the tool compares your % to Lewand corpus frequencies (E 12.702%, T 9.056%, A 8.167%...) and highlights deviations > 4%.
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.
Cipher Text Analysis
Check frequency patterns in encrypted text to identify substitution ciphers.
Bigram Writing Style Analysis
Analyze common letter pairs to study writing style and language patterns.
Full Character Distribution
Count everything including spaces, digits and punctuation for complete statistics.
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 measures randomness: -Σ p·log₂(p). Low entropy (~3-4 bits) means predictable, repetitive text. High entropy (~4.5+ bits for letters) means more uniform distribution. Index of Coincidence measures the probability that two random letters are identical. Natural English is about 0.0667, random text is about 0.0385. Cryptanalysts use IoC to detect if text is encrypted or to guess key length.
Can this tool handle Unicode, emojis, and non-English text?
Can this tool handle Unicode, emojis, and non-English text?
Yes. Counting uses Unicode-aware Array.from() and regex properties \p{L} and \p{N}, so accented letters, Cyrillic, Arabic, Chinese characters, and emojis are counted as single characters. Turn off Unicode: on to restrict analysis to ASCII only (code points 0-127). 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 contiguous sequence of N tokens. 1-gram = single characters, bigram = 2 characters like th, he, trigram = 3 characters like the, ing. Analyzing bigrams and trigrams reveals writing style, common phonetic patterns, and is essential for breaking ciphers and building language models. The tool builds n-grams 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?
In English, E is most frequent (~12.7%), followed by T, A, O. In a simple substitution cipher, letter frequencies are preserved but remapped. Paste the ciphertext, set Letters only and Case insensitive, enable English reference, and compare your top bars to the amber expected lines. If your top cipher letter is K, it likely maps to E. Repeat with bigrams (th, he are most common) to confirm.
Is my text private? Do you store or send it?
Is my text private? Do you store or send it?
No. The entire analysis runs 100% in your browser using JavaScript. No text is sent to a server, stored in localStorage, or logged. You can disconnect from the internet and it will still work. Exports (CSV/JSON) are generated locally via Blob URLs.
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.