Anagrams, palindromes and pangrams: a field guide to word play

Most word games are rules about letters: use all of them, use each only once, read them backwards, change one at a time. Learn half a dozen of these rules and you have a game for a train journey, a classroom warm-up or a fridge door.
This guide covers the classic forms of letter play in English, with examples you can check yourself. Every example below was verified letter by letter; where a famous line has a disputed or unknown author, we say so rather than guess.
Anagrams: the same letters, rearranged
An anagram rearranges every letter of a word or phrase, exactly once, to make another. The word comes, through French and New Latin, from Greek roots meaning roughly "letters back" or "letters anew" (see the entry in Merriam-Webster). The strict rule matters: no letter may be added, dropped or used twice.
Some pairs are single words: listen and silent, evil and vile, night and thing. The memorable ones rearrange a word into a phrase that comments on it:
- dormitory → dirty room
- astronomer → moon starer
- schoolmaster → the classroom
- the eyes → they see
- a gentleman → elegant man
- eleven plus two → twelve plus one, which is true in both letters and arithmetic
Spaces and punctuation are ignored; only letters count. Writers have long used anagrams as pen names, and puzzle setters use them as the backbone of cryptic crossword clues, where a word such as "broken", "mixed" or "wild" signals that the letters nearby must be rearranged.
Checking an anagram
By hand, cross off each letter of the first phrase as you find it in the second; anything left over on either side means it fails. In code, the standard trick is to normalise both strings and sort their letters. If the sorted strings match, the phrases are anagrams:
function isAnagram(a, b) {
const key = s => s.toLowerCase().replace(/[^a-z]/g, '').split('').sort().join('');
return key(a) === key(b);
}
isAnagram('Dormitory', 'dirty room'); // true
The same sorted "key" is how anagram solvers work: they sort every word in a list such as the one behind our spell checker and group the words that share a key, so enlist, inlets, listen, silent and tinsel all land in one bucket.
Palindromes: the same both ways
A palindrome reads the same forwards and backwards, again ignoring spaces, punctuation and capitals. Single words include level, rotator, racecar and noon. James Joyce coined tattarrattat, a knock at the door, in Ulysses (1922); at twelve letters it is often quoted as the longest palindromic word in the Oxford English Dictionary.
Phrase palindromes are harder and more satisfying. A man, a plan, a canal: Panama is usually credited to the British puzzle enthusiast Leigh Mercer, who published it in 1948. Never odd or even and Was it a car or a cat I saw? are well known but of uncertain origin. The oldest celebrated example is the Latin Sator square, SATOR AREPO TENET OPERA ROTAS, which reads the same in four directions and was found scratched into walls at Pompeii.
Checking one in code is a one-liner once the text is normalised:
const isPalindrome = s => {
const t = s.toLowerCase().replace(/[^a-z]/g, '');
return t === [...t].reverse().join('');
};
A related form, the semordnilap (palindromes spelled backwards), is a word that makes a different word when reversed: stressed and desserts, drawer and reward, live and evil.
Pangrams: every letter at least once
A pangram uses all 26 letters of the alphabet. The quick brown fox jumps over the lazy dog (35 letters) has been used to show off typefaces and test typewriters since the late nineteenth century, and is still what many font previews display. The game is to get as close to 26 letters as possible without the sentence collapsing into nonsense:
| Pangram | Letters |
|---|---|
| The quick brown fox jumps over the lazy dog | 35 |
| Pack my box with five dozen liquor jugs | 32 |
| Sphinx of black quartz, judge my vow | 29 |
A pangram that uses every letter exactly once is called perfect. The few that exist in English lean on obscure words or abbreviations, which is why most people settle for the readable ones above. If you design or test a font, a pangram is a quick way to see every letter in context; for a spell checker, it is a handy smoke test, because a correctly spelled pangram should come back with nothing underlined.
Isograms and lipograms: rules about which letters
An isogram (also called a heterogram) is a word in which no letter repeats. Uncopyrightable and dermatoglyphics both manage fifteen letters with none used twice, and are the usual answers to the question of the longest common English isogram.
A lipogram leaves a letter out entirely. The famous ones avoid e, the most common letter in English: Ernest Vincent Wright's novel Gadsby (1939) and Georges Perec's French novel La Disparition (1969), which Gilbert Adair translated into English as A Void (1994), also without a single e. Perec belonged to the Oulipo, the Paris group that treats constraints as a way of generating writing; our writing prompts for word tiles include a lipogram exercise and other Oulipo games you can try in ten minutes.
Word ladders: one letter at a time
Lewis Carroll invented this one. He called it Doublets and published the rules in Vanity Fair in 1879: turn one word into another of the same length by changing a single letter at each step, with every intermediate step a real word. His own example turns HEAD into TAIL:
HEAD → HEAL → TEAL → TELL → TALL → TAIL
The Lewis Carroll Resources site reproduces his rules and puzzles. Programmers will recognise the structure: each step is a word at an edit distance of exactly one substitution from the last, so finding the shortest ladder is a breadth-first search through a word list. Our walkthrough of Levenshtein distance in JavaScript explains the distance measure, and the same "one edit away" idea is how a spell checker proposes corrections, as described in how spell checkers work.
Spoonerisms and other sound games
Not every game is about spelling. A spoonerism swaps the opening sounds of two words, as in a blushing crow for a crushing blow. It is named after William Archibald Spooner, warden of New College, Oxford, to whom many such slips were attributed, though most of the famous ones are thought to have been invented by others. Spoonerisms work on sounds rather than letters, which is why they belong alongside the homophones that spell checkers miss: both remind you that English spelling and English sound are only loosely tied together.
Playing with tiles
Physical or on-screen letter tiles make most of these games easier, because moving a letter is faster than rewriting a word. On the magnetic poetry board you can add your own words as tiles, so a few ways to play:
- Anagram race. Add the letters of a long word as single-letter tiles, then see how many shorter words, or one complete anagram, you can build from them.
- Palindrome builder. Start from a centre letter and add tiles symmetrically. Short phrases such as top spot or step on no pets are achievable in a few minutes.
- Ladder on the fridge. Lay out a four-letter start and end word and fill the steps between them, one changed tile per row.
- Pangram golf. Write a sentence that uses every letter, then try to cut it down; fewer letters wins.
When you finish, paste the result into the spell checker: it will confirm that each word in your anagram or ladder is in the list, which is the one rule these games all share. The history behind cutting up and rearranging words on a surface, from Dada hats to the fridge kit, is in where magnetic poetry comes from.
Spelling & writingWriting prompts for word tiles
Twenty-four prompts and Oulipo-style constraints, from warm-ups to N+7.
Spelling & writingWhere magnetic poetry comes from
From Tzara's hat and the exquisite corpse to cut-ups and the fridge door.
Under the hoodLevenshtein distance in JavaScript
Edit distance step by step, with the Damerau transposition variant.