Skip to content
ZeroServer.tools

Anagram Checker

Check whether two words or phrases are anagrams of each other.

Compare Strings
String A Letters: 0String B Letters: 0

How anagram checking works

Two strings are anagrams if they contain exactly the same letters in any order, ignoring case, spaces, and punctuation. The simplest algorithm strips non-letters, lowercases both strings, sorts their characters, and compares — if the sorted arrays match, they're anagrams. Classic examples include listen / silent, astronomer / moon starer, and the Morse code / here come dots. For related tools, try the Palindrome Checker or Letter Counter.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Settling whether two words really use the same letters for a puzzle or a game.
  • Checking a proposed anagram before publishing it in a crossword clue.
  • Verifying a word-game answer against the letters available.
  • Comparing two phrases while ignoring spaces and punctuation.
  • Testing an implementation against a known pair of anagrams.

Frequently Asked Questions

How is an anagram detected?
By normalising both strings — lowercase, strip spaces and punctuation — then comparing sorted characters or letter-frequency maps. The frequency-map method is O(n) against sorting's O(n log n), and matters on long phrases.
Do spaces and punctuation matter?
By convention no. "Dormitory" and "dirty room" is a classic anagram precisely because the space is ignored. A checker comparing raw strings rejects nearly every real example.
What about accented letters?
A genuine judgement call. Unicode NFD lets you compare base letters and treat é as e, but in languages where the accent marks a distinct letter, folding them makes false matches. State the rule rather than assuming.
What is a perfect or antigram anagram?
A perfect anagram uses every letter exactly once with no leftovers. An antigram is an anagram meaning the opposite — "restful" and "fluster", or "funeral" and "real fun" — which is a wordplay category rather than a different test.
Is a word an anagram of itself?
Trivially yes by the letter test, which is why most checkers reject identical input explicitly. Whether that is correct depends on your purpose — for puzzle validation it is a degenerate case worth rejecting.
How is the comparison done efficiently?
By normalising and sorting the letters of each string, or by comparing letter counts. Sorting makes the check a single string comparison, which is why the canonical form is also what anagram dictionaries index on.
Do the two words need to be real words?
Not for the check — it is purely a letter test, so any two strings with the same multiset qualify. Whether the result is a meaningful anagram is a dictionary question the letter comparison cannot answer.

Common errors and gotchas

  • Comparing with spaces and punctuation included, which fails almost every phrase anagram.
  • Comparing case-sensitively, so a capitalised word never matches its lower-case anagram.
  • Counting a repeated letter once, which turns a multiset comparison into a set comparison.
  • Assuming accented characters match their base letters, which they do not without normalising.
  • Treating an identical word as an anagram of itself, which most definitions exclude.

Related Text Tools tools

Private & free — this tool runs entirely in your browser.