How Anagram Solvers Work — Algorithm Explained
An anagram solver takes a set of letters and returns every valid word those letters can form — in milliseconds. This guide explains exactly how that works: the algorithms, the data structures, the edge cases, and the differences between solver types. No programming experience required.
What Is an Anagram Solver?
An anagram solver is a tool that accepts a set of letters as input and returns all valid English words that can be formed from those letters. The letters can be used in any order — but each letter can only be used as many times as it appears in the input. Enter LISTEN and a solver returns SILENT, ENLIST, TINSEL, INLETS, LITE, LINE, SINE, and dozens more.
The key insight that makes this computationally tractable: anagram detection is a comparison problem, not a generation problem. Rather than trying to construct words by rearranging letters (which would be computationally expensive), modern solvers check each word in a pre-built database against the available letters. This turns an exponentially complex generation task into a linear scan.
For the foundational definition of anagrams themselves, see our guide: What Is an Anagram?
| Input | Mode | Results Include | Use Case |
|---|---|---|---|
| LISTEN | Exact | SILENT, ENLIST, TINSEL, INLETS | Anagram finding |
| LISTEN | Subset | All exact results plus TILE, LINE, LITE, LENS, SINE... | Scrabble, word games |
| SILEN? | Subset + wildcard | SILKEN, LINERS, LINSEY (? = any letter) | Blank tile solving |
| 5-letter filter | Subset | Only 5-letter results | Wordle solving |
How Humans Find Anagrams Manually
Before digital solvers, anagram enthusiasts used a combination of pattern recognition and systematic trial and error. A skilled human anagrammatist working manually with TRIANGLE might:
- Group vowels (I, A, E) and consonants (T, R, N, G, L)
- Look for common word endings: -ING (TRIANGLE has I, N, G), -ATE, -ALE, -ATE
- Try TRIANGL-E: does INTEGRAL work? I, N, T, E, G, R, A, L — yes, all letters present
- Systematically attempt combinations until all valid words are found
This process is effective for short words but becomes impractical for longer ones. TRIANGLE has over 40,000 possible letter permutations. Checking each manually against a dictionary is not feasible. This is the problem digital solvers solve — they check all possibilities systematically and instantly.
The Alphabetical Sorting Method
The simplest algorithm for detecting anagrams is alphabetical sorting. The principle: if two words are anagrams of each other, sorting their letters alphabetically produces identical strings.
How It Works — Step by Step
| Word | Individual Letters | Sorted Alphabetically | Anagram Match? |
|---|---|---|---|
| LISTEN | L, I, S, T, E, N | E, I, L, N, S, T | All four produce EILNST → All anagrams of each other ✅ |
| SILENT | S, I, L, E, N, T | E, I, L, N, S, T | |
| ENLIST | E, N, L, I, S, T | E, I, L, N, S, T | |
| TINSEL | T, I, N, S, E, L | E, I, L, N, S, T | |
| CASTLE | C, A, S, T, L, E | A, C, E, L, S, T | ACELST ≠ EILNST → Not an anagram ❌ |
This method works reliably and is easy to understand. However, it has a practical limitation for database scanning: sorting a candidate word's letters on every check adds processing overhead. For a database of 270,000 words, this overhead accumulates. This is why most production solvers use the frequency map approach instead — which achieves the same result with a simpler comparison operation.
The TRIANGLE Family via Sorting
TRIANGLE sorted = A, E, G, I, L, N, R, T = AEGILNRT
Any word that sorts to AEGILNRT is an anagram of TRIANGLE. Four valid English words do: ALERTING, INTEGRAL, RELATING, TANGLIER — all sort to AEGILNRT. This is why the TRIANGLE family is celebrated: four valid eight-letter anagrams from one letter set is exceptional.
Letter Frequency Matching
The frequency map method is the most widely used approach in modern anagram solvers. Instead of sorting letters, it converts input into a character frequency map — a data structure that records how many times each letter appears.
Building a Frequency Map
| Input Word | Frequency Map | Total Letters |
|---|---|---|
| LISTEN | L:1, I:1, S:1, T:1, E:1, N:1 | 6 |
| TRIANGLE | T:1, R:1, I:1, A:1, N:1, G:1, L:1, E:1 | 8 |
| RETAINS | R:1, E:1, T:1, A:1, I:1, N:1, S:1 | 7 |
| AELST | A:1, E:1, L:1, S:1, T:1 | 5 |
| STRESSED | S:2, T:1, R:1, E:2, D:1 | 8 |
How the Comparison Works
Once the input frequency map is built, the solver scans its word database. For each candidate word, it builds that word's frequency map and compares it to the input map.
In Exact mode: the two maps must be identical. LISTEN's map is {L:1,I:1,S:1,T:1,E:1,N:1}. SILENT's map is {S:1,I:1,L:1,E:1,N:1,T:1}. Identical — valid result. CASTLE's map is {C:1,A:1,S:1,T:1,L:1,E:1}. Different — rejected.
In Subset mode: every letter in the candidate word's map must be present in the input map with an equal or greater count. The candidate does not need to use every input letter. For LISTEN's map, a candidate word LIT {L:1,I:1,T:1} passes — all three letters are present in sufficient quantity in the input. This is how Scrabble rack analysis works: find all valid words the rack can make, regardless of which tiles remain unused.
Why STRESSED = DESSERTS
STRESSED has eight letters: S, T, R, E, S, S, E, D. The frequency map is {D:1, E:2, R:1, S:3, T:1} — S appears three times, E appears twice, and D, R, T each appear once.
DESSERTS has eight letters: D, E, S, S, E, R, T, S. The frequency map is {D:1, E:2, R:1, S:3, T:1} — identical to STRESSED in every position. The two words are confirmed anagrams.
As a further curiosity, DESSERTS spelled backwards is STRESSED — making this pair both a perfect anagram and a perfect reversal simultaneously, which is exceptionally rare in English.
The Complete Solver Workflow
Here is how a typical modern anagram solver processes a query from input to results:
| Step | Operation | Example (input: LISTEN) |
|---|---|---|
| 1 | Receive input | User types "LISTEN" |
| 2 | Normalise input | Convert to uppercase, strip spaces: "LISTEN" |
| 3 | Identify wildcards | Count ? characters (zero in this case) |
| 4 | Build frequency map | {L:1, I:1, S:1, T:1, E:1, N:1} |
| 5 | Apply length filter | Minimum 3 letters (default), maximum 6 (input length, exact mode) |
| 6 | Scan word database | Check each of 270,000 words against the frequency map |
| 7 | Validate each word | Does SILENT fit within {L:1,I:1,S:1,T:1,E:1,N:1}? Yes. Does CASTLE? No. |
| 8 | Calculate scores | Score each result using Scrabble tile values: ENLIST = 6pts |
| 9 | Sort results | By length, Scrabble score, or alphabetically per user preference |
| 10 | Group by length | 6-letter: SILENT, ENLIST, TINSEL, INLETS; 5-letter: LIENS, LENIS... |
| 11 | Return results | Display to user with length tabs and copy functionality |
The AELST Example — Most Productive 5-Letter Set
AELST (A:1, E:1, L:1, S:1, T:1) is the most productive 5-letter letter set in English. Running this through exact mode returns six valid common words: SLATE, STALE, LEAST, TALES, STEAL, TESLA. Each of these six words has an identical frequency map to the others — they form an anagram family. This is an unusually high yield for a 5-letter set; most 5-letter combinations produce one or two valid exact anagrams.
Wildcard Processing
Wildcard support — typically represented by the ? character — is one of the most practically useful features in anagram solvers. It represents any single letter and is used for blank Scrabble tiles, partially known crossword answers, and exploratory word finding.
How One Wildcard Is Processed
When input contains one ?, the solver runs 26 parallel checks — one for each letter of the alphabet substituted for the wildcard. For SILEN?, the solver checks SILENA, SILENB, SILENC... through SILENZ. For each substitution, it builds the frequency map and runs the standard database scan. Valid results from all 26 passes are collected and deduplicated.
| Wildcard Input | Substitutions Tried | Valid Results Found |
|---|---|---|
| SILEN? | SILENA through SILENZ (26) | SILKEN (K=SILKEN), LINERS (R=LINERS), LINSEY (Y=LINSEY), LISTEN (T=LISTEN) |
| ??STEN | 676 combinations (26×26) | FASTEN, HASTEN, LASTEN, and all valid completions |
| L?STEN | 26 combinations | LISTEN (I substituted), FASTEN and HASTEN require different letter sets — only LISTEN is valid from L?STEN |
Two Wildcards
Two wildcards multiply the search by 26 twice — 676 substitution combinations per word in the database. This is more computation, but well-optimised solvers complete the full database scan across all substitutions quickly. The practical benefit is significant: two blank Scrabble tiles dramatically expand the available words, and a solver that handles double wildcards is far more useful for competitive play.
Exact Mode vs Subset Mode
This distinction is the most practically important one for users. Both modes use the same frequency map algorithm — they differ only in what constitutes a valid match.
| Feature | Exact Mode | Subset Mode |
|---|---|---|
| Match requirement | Result must use every input letter exactly once | Result can use any combination of input letters |
| Result length | Must equal input letter count | Any length up to input count |
| Primary use case | Jumble puzzles, anagram creation, Text Twist | Scrabble, Boggle, Bananagrams, word finding |
| LISTEN results | SILENT, ENLIST, TINSEL, INLETS only | All exact results plus TILE, LENS, LINE, SINE, LET, TIN... |
| Result count | Fewer — all letters must be used | More — partial combinations included |
| Algorithm difference | Maps must be identical | Candidate map must fit within input map |
RETAINS in Both Modes
RETAINS (R:1, E:1, T:1, A:1, I:1, N:1, S:1) demonstrates the difference clearly.
Exact mode results (all 7 letters used): NASTIER, STAINER, STEARIN, ANTSIER, RETAINS — five valid 7-letter anagrams. This is the AEINRST family, the most productive 7-letter set in Scrabble, where each result earns the 50-point bingo bonus.
Subset mode results include all exact results plus shorter words: RETAIN, RATINE, TRAINS, RAINS, NEARS, EARNS, RATES, TEARS, RANTS, TINS, AIRS, and hundreds more — any valid word whose letters are available within the RETAINS rack.
To try both modes on any letter set, visit our Anagram Solver and use the mode selector.
Scrabble Rack Solving
Scrabble solvers are subset mode anagram solvers with one additional feature: Scrabble score calculation. For each valid word in the results, the solver calculates the base Scrabble point value by summing the official tile values of its letters.
Scrabble Score Calculation
| Letter | Value | Letter | Value | Letter | Value | |
|---|---|---|---|---|---|---|
| A, E, I, O, U, L, N, S, T, R | 1pt | D, G | 2pts | B, C, M, P | 3pts | |
| F, H, V, W, Y | 4pts | K | 5pts | J, X | 8pts | |
| Q, Z | 10pts | Blank tile | 0pts | |||
When results are sorted by Scrabble score, the highest-value plays appear first. A player holding RETAINS sees NASTIER (7pts base) at the top of score-sorted results — but the real value comes from the 50-point bingo bonus for using all 7 tiles, making each of these results worth 57pts minimum before premium squares.
Blank Tile Handling in Scrabble
Blank tiles are represented by ? in the solver. They contribute 0 points when used. The solver correctly assigns zero value to the letter a blank substitutes for — so if ? substitutes for Z in a word, that Z scores 0 points rather than 10. This is the official Scrabble rule for blanks.
Try our Scrabble Solver for full rack analysis with score sorting and bingo finding.
Performance and Database Size
Two factors determine how useful an anagram solver is in practice: how fast it processes queries and how many words its database contains.
Database Size
| Word List | Approximate Size | Used For | Coverage |
|---|---|---|---|
| TWL (Tournament Word List) | ~178,000 words | North American Scrabble | Standard for US/Canada tournament play |
| SOWPODS | ~267,000 words | International Scrabble | Includes all TWL words plus 89,000 more |
| ENABLE | ~173,000 words | Words With Friends | Different from TWL — some words differ |
| Standard English dictionary | 470,000+ | General vocabulary | Includes proper nouns, technical terms |
| Combined (TWL + SOWPODS + English) | 270,000+ unique | Comprehensive solving | Best coverage for all word games |
A solver is only as complete as its word list. A solver using only TWL misses approximately 89,000 words valid in SOWPODS. A solver missing common English words will fail to find valid results that any standard dictionary would include. Database completeness is the primary quality differentiator between anagram solvers.
Processing Speed
Modern solvers process queries quickly through several design choices. Pre-loading: the word database is loaded into memory on first use rather than fetching from a server on each query. Local processing: browser-based solvers run entirely on the user's device, eliminating network round-trips. Efficient data structures: frequency maps enable constant-time letter checking rather than character-by-character comparison.
Server-based solvers introduce network latency on top of processing time. A query that processes locally in milliseconds becomes noticeably slower when it requires a round-trip to a server. For interactive use — where users expect immediate results — local processing is significantly better from a user experience perspective.
Algorithm Comparison
| Method | How It Works | Strengths | Limitations |
|---|---|---|---|
| Alphabetical sorting | Sort both words; compare sorted forms | Simple; easy to understand and implement | Sorting overhead on every comparison |
| Frequency map | Count letter occurrences; compare maps | Fast comparison; handles subset mode naturally | Map construction step required |
| Hash-based | Hash the sorted letters; compare hashes | Very fast lookup in pre-built databases | Pre-computation required; less flexible |
| Trie / prefix tree | Navigate tree structure by letter | Efficient for pattern matching with known positions | More complex; better for crossword than anagram |
Can AI Solve Anagrams?
Large language models like GPT-4, Gemini, and Claude can suggest anagram solutions, but they approach the problem differently from dictionary-based solvers — and with different reliability characteristics.
How Language Models Handle Anagrams
Language models generate text by predicting likely next tokens based on patterns learned from training data. When asked for anagrams of LISTEN, a language model may correctly suggest SILENT (a well-known pair) but is less reliable at finding TINSEL or INLETS — words that are valid but less commonly associated with LISTEN in text. The model generates plausible-sounding answers rather than systematically checking all valid words.
For common short anagrams, language models perform well. For exhaustive results — finding every valid word from a 7-tile Scrabble rack — dictionary-based frequency map solvers are both faster and more complete. No language model reliably finds all valid Scrabble words from an arbitrary 7-tile combination without missing some valid plays.
Where AI Adds Value
AI tools are genuinely useful for adjacent anagram tasks: explaining why two words are anagrams, generating creative phrase anagrams (where judgment about meaning matters), or suggesting which anagrams have semantic connection to the original. These tasks require language understanding rather than exhaustive enumeration — exactly what language models are good at.
For exhaustive word finding from a letter set, use a dictionary-based solver. For creative wordplay and semantic anagram suggestions, language models can be a useful complement.
Word Unscrambler vs Anagram Solver
These terms are often used interchangeably. The underlying algorithm is identical in both cases. The practical difference is in how they are applied:
| Tool | Typical Use | Mode | Expected Output |
|---|---|---|---|
| Word Unscrambler | Finding the correct answer in a puzzle (Jumble, Text Twist) | Exact — all letters required | The specific word the puzzle intends |
| Anagram Solver | Exploring all words a letter set can produce | Exact or Subset | Complete list of all valid words |
| Scrabble Solver | Finding highest-scoring rack play | Subset + score sort | All valid plays, ranked by points |
| Word Finder | Finding words from available letters for any game | Subset | All valid words from the letter pool |
Our Word Unscrambler and Anagram Finder both use the same frequency map algorithm — the mode selector determines which type of results you see.