
Anagram Checker
Compare two strings to determine if they are anagrams of each other. See character frequencies, sorted forms, and generate new anagrams.
Last reviewed: April 2026New to this tool? Click here for instructions
How to Use the Anagram Checker
To use the Anagram Checker, follow these steps:
1. Enter two strings in the input fields.
2. Click the 'Check' button to see if they are anagrams.
3. The tool will display the sorted character forms and a character frequency comparison table.
When to Use the Tool in Real Workflows
Use the Anagram Checker when you need to verify if two words or phrases are anagrams. It's useful in word games, cryptography, and coding interviews. The tool helps in quickly determining anagram relationships and can be a valuable resource for competitive players.
How It Works
The Anagram Checker works by sanitizing the input strings, sorting the characters, and comparing the sorted forms. If the sorted strings are identical, the original strings are anagrams. The character frequency table provides a detailed view of how many times each letter appears in each string, highlighting any mismatches.
Tips, Edge Cases, or Limitations
1. Capitalization and spacing do not matter. The tool converts all characters to lowercase before processing.
2. The tool does not filter anagram results to ensure they are real words. It only checks if the letter combinations match.
3. For competitive use, memorize high-value anagram pairs and rare two-letter words to maximize scoring opportunities.
Frequently Asked Questions
Instantly verify if two words or phrases are anagrams by comparing their character frequency inventories. Paste any two strings — single words, multi-word phrases, even full sentences — and the tool shows a side-by-side letter count alongside a clear yes/no verdict.
What This Tool Does
The Anagram Checker compares the normalized character inventories of two inputs and reports whether they contain exactly the same letters in exactly the same quantities. Before any comparison runs, the tool strips spaces and punctuation, lowercases both strings, then compares sorted character arrays. What it does not do is validate either input against a word list — it won't tell you whether "Moon Starer" or "Astronomer" is a real English word, only whether they share an identical letter inventory. Neither the TWL06 nor the SOWPODS Scrabble dictionary is consulted. The output is a binary anagram verdict plus a side-by-side character frequency breakdown that makes mismatches visually obvious.
How to Use It
Step-by-step instructions
- Type or paste the first word or phrase into the left input pane (labelled String A).
- Type or paste the second word or phrase into the right input pane (String B).
- Click Check Anagram or press Enter. The tool immediately strips spaces and punctuation from both inputs before any comparison runs.
- Read the result banner — a green ✅ for a confirmed anagram or a red ✗ with the first mismatched character highlighted in the frequency table.
- Not sure what to paste? Hit Try Example to pre-load the classic The Eyes / They See pair.
Worked example: 'The Eyes' vs 'They See'
The inputs below walk through every step the tool executes internally.
Worked Example
- Input A
The Eyes- Input B
They See
- Strip spaces and punctuation from both inputs:
"The Eyes"→"TheEyes"
"They See"→"TheySee" - Lowercase both strings:
"theeyes"and"theysee" - Build character frequency maps:
A:{t:1, h:1, e:3, y:1, s:1}
B:{t:1, h:1, e:3, y:1, s:1} - Sort both character arrays:
"theeyes".split('').sort().join('')→"eeehtsy"
"theysee".split('').sort().join('')→"eeehtsy" - Compare sorted strings:
"eeehtsy" === "eeehtsy"→true - Render side-by-side frequency table — all five rows match; no red-highlighted mismatches.
- Display result banner: ✅ Anagram confirmed.
Expected output: ✅ Anagram confirmed. Normalized sorted form for both: eeehtsy. Character frequency: E(3) H(1) S(1) T(1) Y(1).
| Character | The Eyes | They See |
|---|---|---|
| E | 3 | 3 |
| H | 1 | 1 |
| S | 1 | 1 |
| T | 1 | 1 |
| Y | 1 | 1 |
How Anagram Checking Works: The Algorithm
Sorting approach vs. frequency-map approach
Two mainstream algorithms solve the anagram-equality problem. The sorting approach normalizes each string, lowercases it, strips non-alphabetic characters, splits into individual characters, sorts that array, then joins it back into a string. Two strings are anagrams when those joined strings are identical. Time complexity is O(n log n), dominated by the sort step, where n is the length of the string after stripping.
The frequency-map approach builds a character-count dictionary for each string in a single linear pass, then compares the two dictionaries entry by entry. Time complexity is O(n) with O(k) auxiliary space, where k is the size of the character alphabet — 26 for plain ASCII lowercase, larger for Unicode inputs. This tool uses the frequency-map approach to populate the visible output table, then verifies the final equality claim via a sorted-string comparison as a deterministic second check. Both approaches produce the same answer; the two-pass design surfaces richer diagnostic data without a meaningful performance cost for realistic inputs.
Unicode normalization and why it matters
Before any letter comparison, the tool applies Unicode NFC normalization per UTS #15 (Unicode Normalization Forms). NFC (Canonical Decomposition followed by Canonical Composition) ensures that precomposed and decomposed representations of the same character are treated as identical. Consider the é in "café": one encoding stores it as the single precomposed code point U+00E9, while another stores it as the base letter e (U+0065) followed by the combining acute accent U+0301. At the byte level these look different, but after .normalize('NFC') both collapse to U+00E9 and compare equal. Without this step, two strings that look identical on screen can produce a false "not an anagram" result. An optional diacritic-strip mode goes further — removing all combining marks after NFD decomposition so that "résumé" and "resume" are treated as if they share the same letter inventory.
Edge Cases and Gotchas
Spaces and punctuation stripping
Every space, comma, apostrophe, hyphen, and other punctuation mark is removed before comparison. That's why "Moon Starer" and "Astronomer" correctly resolve as anagrams: stripping the space from "Moon Starer" leaves both sides with the same 10-letter inventory. The standard definition of an anagram excludes whitespace from the letter count, so there is no mode that includes spaces in the comparison.
Accented characters and diacritics
By default the tool normalizes to NFC and treats each fully composed character as a distinct letter. Under this setting, "résumé" (with two accented e's) is not an anagram of "resume" (with two plain e's), because é ≠ e. Enable the optional Strip diacritics toggle in the options panel to fold all accented characters down to their base ASCII equivalents before comparison, which makes "résumé" and "resume" match. The Character Frequency Analyzer tool can help you inspect what the tool actually sees after normalization if a result surprises you.
Numbers and special characters
Digits are treated as valid characters by default — they count toward the inventory just like letters. "2fast" and "fast2" are confirmed anagrams of each other, but "2fast" and "fast" are not, because the digit 2 appears in the first and is absent from the second. Disable the Include numbers option before checking if you want numeric characters excluded from the inventory, bringing behavior in line with the traditional letter-only definition. Emoji deserve a specific callout: multi-codepoint emoji such as the family emoji (U+1F468 U+200D U+1F469) are treated as separate codepoints, so comparisons can return unexpected counts if emoji appear in either input.
Case sensitivity
Capitalization is always ignored. "Listen" and "SILENT" produce identical normalized forms after lowercasing — both yield eilnst when sorted. This matches every major word game convention and the standard definition of an anagram. There is no case-sensitive mode because case-sensitive anagrams are not a standard concept.
On practical length limits: inputs up to roughly 5,000 characters return an instant result. Strings above 10,000 characters may cause a perceptible processing delay as the frequency table renders, though the algorithm handles them correctly.
Character Frequency Tables Explained
Reading the frequency table
The frequency table renders one row per unique character found in either input, with counts for String A and String B displayed side by side. Any row where the two counts differ is highlighted in red, immediately identifying which letters are surplus on one side or missing from the other. If no rows are highlighted, the inputs are anagrams. This makes the table more informative than a bare yes/no result: when the answer is "no", you can see at a glance whether you're one letter short, have a doubled character in the wrong place, or accidentally included a punctuation mark that survived stripping.
LISTEN vs SILENT as a reference example
The LISTEN / SILENT pair is the most commonly cited minimal example in tutorials because both words use exactly six distinct letters, each appearing once. The table below shows why this pair always confirms as an anagram.
| Character | Count in LISTEN | Count in SILENT | Match? |
|---|---|---|---|
| L | 1 | 1 | Yes |
| I | 1 | 1 | Yes |
| S | 1 | 1 | Yes |
| T | 1 | 1 | Yes |
| E | 1 | 1 | Yes |
| N | 1 | 1 | Yes |
ASTRONOMER vs MOON STARER is a more complex case: after stripping the space from "Moon Starer", both sides produce a 10-letter inventory with A(1) E(1) M(1) N(1) O(3) R(2) S(1) T(1) — all eight characters match. The Character Frequency Analyzer can break down any individual string's distribution if you want to study a single input in more depth.
Common Anagram Pairs and Examples
The pairs below are letter-inventory matches confirmed by sorting — none are validated against any official word list such as TWL or SOWPODS. All are fair game to paste directly into the tool as test cases.
| Phrase A | Phrase B | Letter Count (shared) | Notes |
|---|---|---|---|
| LISTEN | SILENT | 6 | Simplest widely cited pair; the go-to tutorial example |
| THE EYES | THEY SEE | 7 | Phrase-level anagram; space stripped before comparison |
| ASTRONOMER | MOON STARER | 10 | Classic 10-letter pair; space stripped from Phrase B |
| DORMITORY | DIRTY ROOM | 9 | Spatial anagram; space stripped from Phrase B |
| CONVERSATION | VOICES RANT ON | 12 | Sentence-length anagram; two spaces stripped |
| ELEVEN PLUS TWO | TWELVE PLUS ONE | 12 | Numeric phrase; arithmetic identity too (11+2 = 12+1 = 13) |
The ELEVEN PLUS TWO / TWELVE PLUS ONE pair is a favourite because it doubles as an arithmetic identity: both phrases describe the number 13. CONVERSATION / VOICES RANT ON is a good stress test for the tool because it involves two spaces stripped from Phrase B — a step some naive implementations handle incorrectly.
Behind the Scenes: Sorting and Normalization
JavaScript implementation sketch
The core normalization function used in the tool is a single expression:
function normalize(str) {
return str
.normalize('NFC') // Unicode Canonical Composition per UTS #15
.toLowerCase() // fold case
.replace(/[^a-z]/g, '') // strip non-alpha (adjust regex to keep digits if needed)
.split('')
.sort((a, b) => a < b ? -1 : 1) // explicit comparator for determinism
.join('');
}
// Anagram check:
const isAnagram = normalize(inputA) === normalize(inputB);
Two strings are anagrams when normalize(a) === normalize(b). The explicit sort comparator (a, b) => a < b ? -1 : 1 is intentional: the default Array.prototype.sort() can invoke locale-sensitive collation in some JavaScript engines, producing non-deterministic orderings for certain Unicode ranges. The explicit comparator forces lexicographic byte order, making results consistent across V8, SpiderMonkey, and JavaScriptCore.
Unicode NFC normalization call
The .normalize('NFC') call follows the MDN String.prototype.normalize() specification and the WHATWG Encoding spec. NFC is the right choice for anagram checking because it collapses decomposed accent sequences into single code points before the sort, preventing the false-negative described in the algorithm section above.
One additional edge case to handle in production code: if the input string is composed entirely of spaces, punctuation, or digits that the regex strips, the normalized result is an empty string. Comparing two empty strings returns true — a false-positive anagram match. The tool detects this condition and surfaces a warning ("Input resolves to empty string after stripping — please enter at least one letter") rather than silently confirming two blank inputs as anagrams.
The frequency map itself is built via a reduce() over the character array, accumulating counts into a plain object. This runs in O(n) time with O(k) auxiliary space where k is the number of distinct characters, and produces the per-row data that populates the comparison table in the UI.
| Character | Count in ASTRONOMER | Count in MOON STARER | Match? |
|---|---|---|---|
| A | 1 | 1 | Yes |
| E | 1 | 1 | Yes |
| M | 1 | 1 | Yes |
| N | 1 | 1 | Yes |
| O | 3 | 3 | Yes |
| R | 2 | 2 | Yes |
| S | 1 | 1 | Yes |
| T | 1 | 1 | Yes |
Related Tools and Word Utilities
These tools complement the anagram workflow for deeper word analysis:
- Palindrome Checker — test whether a single string reads the same forwards and backwards; a distinct property from anagram status.
- Character Frequency Analyzer — break down a single input's full letter distribution without needing a second string to compare.
- Word Counter — count words, sentences, and characters for longer text inputs.
- Text Case Converter — transform input to UPPER, lower, Title Case, or camelCase before pasting into the anagram checker.
- Regex Tester — build and test custom character-stripping patterns if the default punctuation rules don't match your use case.