Anagram Finder
How it works
An anagram is a rearrangement of all the letters in a word or phrase to produce a new word or phrase. "Listen" → "Silent". "Astronomer" → "Moon starer". "The classroom" → "Schoolmaster". The Anagram Finder checks whether two inputs are anagrams of each other — and can find all anagrams of a word from a built-in dictionary.
**Algorithm** Two strings are anagrams if and only if they contain exactly the same characters with exactly the same frequencies (ignoring case, spaces, and punctuation). The fastest test: sort both strings and compare. O(n log n). Alternative: build a frequency map (character count array) for each string and compare maps. O(n).
**Multi-word anagrams** The most impressive anagrams span entire phrases: "William Shakespeare" → "I am a weakish speller". "Madam Curie" → "Radium came". "Eleven plus two" → "Twelve plus one". Finding multi-word anagrams requires generating all permutations of the letter pool and checking them against a dictionary — computationally intensive but tractable for short inputs.
**Why anagrams are hard to find manually** "Astronomer" has 10 letters. The number of permutations = 10! = 3,628,800. Even filtering for permutations that start with common English syllables, human pattern recognition can't efficiently explore the full space. Computers solve this in milliseconds.
**Cryptography connection** Anagram-finding is related to the classic "anagram hash" concept: two strings are anagrams iff sorted(str1) == sorted(str2). This is used as a grouping key in algorithmic problems (Leetcode "Group Anagrams"). In Scrabble and word games, finding anagrams from a rack of tiles is the core challenge.
Privacy: all processing runs in the browser. No words are transmitted.
Frequently Asked Questions
- Sort each word's letters and use the sorted form as a dictionary key. Group all words with the same sorted form together. Example: 'listen' → 'eilnst'; 'silent' → 'eilnst'; 'enlist' → 'eilnst' — all map to the same key. This O(n × k log k) algorithm (n = words, k = average length) processes a 100,000-word dictionary in under a second. Looking up anagrams of any word is O(k log k) to sort the input, then O(1) for the dictionary lookup. This is the approach used in Scrabble word checkers.
- Long anagram pairs include: 'conversationalists' / 'conservationalists' (18 letters), 'demonstratives' / 'monstrosive-ated' (debatable), and pairs involving compound words. Some sources cite 'cholecystitides' / 'diethylsuccinic' as among the longest perfect anagram pairs. Word game enthusiasts catalogue these extensively. Multi-word anagram phrases can be much longer: 'William Shakespeare' / 'I am a weakish speller' (19 letters each, ignoring spaces).
- Anagrams appear in: Scrabble (finding the highest-scoring arrangement of available letters is essentially anagram finding under constraints); crossword puzzles (clue indicator words like 'rearranged', 'mixed up', 'confused' signal an anagram answer); word jumbles (newspaper games); cryptic crosswords (the most common clue type is the anagram clue); and literary pen names (Voltaire was an anagram of 'Arouet le j.', his Latinised surname with l.j. for 'le jeune'). They test vocabulary and pattern recognition simultaneously.
- Yes — 'anagram' is an anagram of 'nagaram', 'managar', 'ragaman', and other permutations (not all meaningful English words). More amusingly: 'anagram' → 'nag a ram'. 'The Morse Code' → 'Here come dots'. 'Astronomer' → 'Moon starer'. 'Dormitory' → 'Dirty room'. 'The eyes' → 'They see'. 'George Bush' → 'He bugs Gore'. Finding meaningful anagram pairs from random words is rare — these examples were discovered through exhaustive search over large dictionaries.