Toolkit
All tools
String analysis · Free

Palindrome & Anagram Checker

Does it read the same backwards? Do these two texts use exactly the same letters? Both answers, with the string that was actually compared, its reverse, the first pair that disagrees, the longest palindrome hiding inside, and the letters each side has spare.

Checked in your browser · Nothing uploaded

Palindrome and anagram workspace

The box is empty. Type or paste a word, a phrase, or a sentence to check it.

Palindrome desk

Does it read the same backwards?

One text, four answers: the character reading, the word reading, the longest palindromic run inside it, and how many characters would have to change.

0 characters · 0 compared · 0 words
Try one
Treat as the same character

These decide what counts as the same character; they never rewrite your text. With all three on you get the loose reading everyone means by “palindrome”, the one under which “A man, a plan, a canal: Panama” passes. Turn all three off for the strict reading, where only a literal mirror image counts. Digits, symbols, and emoji are content and are never dropped.

Waiting for text
n/a

Type or paste something above and the verdict appears here, with the pairs that agree and the first pair that does not.

Characters compared
0
Characters ignored
0
Pairs tested
0
Pairs that disagree
0
Words
0
Distinct characters
0
Longest run
n/a
Middle character
n/a
The mirror

What was compared, against its own reverse

The top row is the text after your options were applied; the bottom row is that same text reversed. Every column is a pair. A column with a cross under it is a pair that disagrees, and the middle character of an odd-length text has a diamond, because it has no partner.

The mirror appears here. Type a phrase, or press Near miss above to see a sentence that is two characters away from being a palindrome, with both of them marked.

The other reading

Palindrome word by word

A separate question with a separate answer. Reverse the order of the words instead of the order of the characters and a sentence can mirror itself perfectly while its letters do not.

A word palindrome needs at least two words, because one word read backwards is still one word. Paste a sentence and this reading gets its own verdict.

Longest run

The longest palindrome inside the text

Found with Manacher's algorithm, which scans the whole text once rather than testing every substring, so it stays fast on a long paste of one repeated letter.

The longest palindromic run appears here once there is something to scan.

Letter parity

Could these letters be rearranged into one?

A different question from whether the text already is a palindrome, and a much easier one: it depends only on how many characters appear an odd number of times.

Nothing to rearrange yet.

Reversing is not splitting

Characters here are grapheme clusters, so an accented letter, a flag, and a ZWJ sequence such as an astronaut emoji each reverse as one character. Splitting a string on its code units instead would turn an emoji into two broken halves and move an accent onto the wrong letter.

The options change the question

“A man, a plan, a canal: Panama” is a palindrome only once capitals, spaces, and punctuation stop counting. That is a choice about what the question means, not a trick, which is why the page shows the exact string it compared rather than just the verdict.

Anagram is a multiset, not a set

Two texts are anagrams when their character counts match exactly, repeats included. That is why the difference table counts how many of each character are spare: one missing letter is the whole answer, and knowing which one is what lets you fix it.

Everything you type stays in this tab. There is no word list, no dictionary, and no server: the answers are plain arithmetic on the characters themselves, which is also why the page can tell you a string is a palindrome but never whether it is a word. Each box takes up to 20,000characters. The longest palindromic run is found with Manacher’s algorithm in time proportional to the length of the text, so there is no slow case and no ceiling to fall back on. Your browser supports Intl.Segmenter, so characters are counted and reversed as grapheme clusters: an accented letter, a flag, and a ZWJ emoji each count as one.

How it works

A palindrome is a claim about a normalised string, so the page shows you the string.

Nearly every argument about whether something is a palindrome is really an argument about what counts as the same character. Do capitals matter? Do the commas? Does the é in Ésope match the e in reste? There is no universal answer, so this page makes each of those a switch, prints the exact sequence it compared, prints that sequence reversed, and marks the first place the two part company. The anagram side works the same way: rather than a bare yes or no, it shows the two letter-frequency tables and the surplus on each side, because that is the part that tells you what to change.

  1. 01

    Type the text, or load one of the examples

    One box for the palindrome question, two for the anagram question. Nothing is uploaded and nothing is stored: the whole thing is arithmetic on the characters, running in this tab. The examples include the famous Panama sentence, a French palindrome that needs accents ignored, a sentence that mirrors itself in words but not in letters, and a near miss that is two characters away.

  2. 02

    Decide what counts as the same character

    Case, spaces and punctuation, and accents each get a toggle, because the answer genuinely depends on them. With all three on you get the reading everyone means: a phrase can be a palindrome despite its commas and capitals. With all three off you get the strict reading, where only a literal mirror image passes. The page names which reading produced the verdict.

  3. 03

    Read the working, not just the verdict

    You get the exact string that was compared, that same string reversed, and the first pair of characters that disagree, marked at its position from the start and its position from the end. Alongside that: how many characters would have to change, the longest palindrome hiding inside the text, and whether the letters could be rearranged into one.

Built for word games, crosswords, puzzles, and idle curiosity

Character and word readings, a diagnosable near miss, and letters counted with multiplicity.

Two questions, four answers

Character palindrome and word palindrome are different questions and both get an answer. “You can cage a swallow, can’t you, but you can’t swallow a cage, can you?” is a perfect palindrome in words and nothing like one in letters. The page also reports the longest palindromic run inside the text and the number of characters that would have to change to make the whole thing mirror itself.

A near miss you can diagnose

A verdict of no is useless on its own. The mirror lays the compared string above its own reverse, column by column, so every pair that disagrees is marked at both of its positions. Change “saw” to “was” in “Was it a car or a cat I saw?” and the page tells you it is now two characters away, and which two.

Unicode that survives being reversed

Characters are grapheme clusters, not bytes. Reversing a string by splitting it on code units shatters an emoji into two broken halves and moves a combining accent onto the letter before it. Here an accented letter, a flag, and a ZWJ sequence such as an astronaut each reverse as one character, so 🧑‍🚀 Never odd or even 🧑‍🚀 comes back intact.

The difference table, not just a no

When two texts are not anagrams, the useful output is what is left over. Each side gets its own list of surplus characters with counts, so “Dormitory” against “Dirty rooms” does not just fail: it tells you the second text has one spare s, and deleting it makes the pair exact.

Letter parity, the third question

A bag of letters can be rearranged into a palindrome exactly when at most one letter appears an odd number of times. The page runs that check on every text, names the letter that would have to sit in the middle, and prints one arrangement that works. It is the fastest way to know a rearrangement exists without hunting for it.

Linear time, so there is no slow case

The longest palindromic run is found with Manacher's algorithm, which makes one pass over the text. The obvious approach, growing a palindrome outward from every possible centre, is quadratic and grinds to a halt on exactly the input this tool invites: a long run of one repeated character. There is no work ceiling here because none is needed.

Word-play questions

Panama, tattarrattat, semordnilaps, and why reversing a string is harder than it looks.

Is “A man, a plan, a canal: Panama” really a palindrome?+

Under the reading everyone means, yes. Strip the capitals, the spaces, the commas, and the colon and you are left with amanaplanacanalpanama, twenty-one letters that read identically in both directions. Compare it exactly as written and it fails immediately, because the first character is a capital A and the last is a lowercase a. That is not a technicality worth hiding, it is the whole reason this page puts case, spacing, and punctuation on switches and shows you the string it actually compared. The sentence is usually credited to Leigh Mercer, who published it in Notes and Queries in 1948. Longer members of the same family include “Doc, note: I dissent. A fast never prevents a fatness. I diet on cod.” and Demetri Martin's 224-word palindromic poem, both of which pass here for the same reason.

What is the longest palindrome in English?+

It depends what you will accept as a word. The longest in the Oxford English Dictionary is tattarrattat, twelve letters, coined by James Joyce in Ulysses for a knock at the door. Chemists offer detartrated, eleven letters. The longest in ordinary dictionaries is usually given as redivider, nine letters, with rotator, reviver, and deified at seven each. Outside English the record is easier to beat: Finnish has saippuakivikauppias, nineteen letters, a soapstone vendor, and it is a genuine compound rather than a coinage. Whole sentences go much further, and the practical limit is patience rather than language. Paste any of these into the box and the longest-run panel will confirm the count for you rather than asking you to trust a list.

Do spaces and punctuation count?+

Only if you say so, and the honest answer is that both readings are legitimate. The strict reading treats the text as a sequence of characters and asks whether that sequence is its own reverse, which means a space, a comma, and a capital letter are all characters like any other. The loose reading treats a palindrome as a property of the letters and throws the rest away, which is what makes sentence-length palindromes possible at all. This page defaults to the loose reading because that is what people are asking when they type a sentence, and it says so on the verdict: a phrase that passes only once punctuation is ignored is labelled as a loose-reading pass rather than being quietly waved through. Digits, symbols, and emoji are never dropped by that switch, because they are content: 12321 is a palindrome and should be reported as one.

What is a semordnilap?+

A word that spells a different word when reversed. Stressed becomes desserts, drawer becomes reward, diaper becomes repaid, and the name itself is palindromes spelled backwards. It is not a palindrome, which is the point: a palindrome reads the same in both directions, a semordnilap reads as something else. This page cannot tell you that you have found one, because doing so needs a dictionary and there is no word list here at all. What it does do is print the reversed string, which is the only part a computer is needed for. Read it and judge for yourself. The same limitation explains why the anagram side compares two texts you supply rather than searching for anagrams of one: hunting for an unknown rearrangement means a word list, and a word list means a language, a spelling standard, and an argument about proper nouns.

Are anagrams case sensitive?+

Conventionally no, and this page defaults to ignoring case for exactly that reason. Nobody claims Listen and Silent fail to be anagrams because one of them starts with a capital. Turn the case switch off and they do fail, and you can watch why in the difference table: the first text has a spare capital L and a spare lowercase s, the second a spare capital S and a spare lowercase l, because a capital L and a lowercase l are different characters to a computer. That view is occasionally what you want, for instance when checking whether two identifiers use the same characters. Most of the time it is not, which is why case folding is on by default. Accents work the same way: ignore them and résumé matches resume; keep them and é is simply a different letter from e.

What counts as a perfect anagram?+

Two texts are anagrams when their letters form the same multiset: the same letters, each appearing the same number of times, with only the order differing. The multiset part is what people forget. Anagram is not a comparison of which letters appear, it is a comparison of how many of each, which is why the difference table here counts surplus rather than just listing letters. A perfect anagram, sometimes called a true anagram, is one where the second text is a genuine rearrangement rather than the same text again, and this page separates those two outcomes rather than answering yes to both. It also names the special case where no letter is repeated at all, as in Listen and Silent, which is a permutation of six distinct letters. The classics are worth trying: Eleven plus two and Twelve plus one use the same thirteen letters and mean the same number, and The Morse code rearranges to Here come dots.

Which words can be rearranged into a palindrome?+

There is a one-line test, and it does not involve trying any rearrangements. A multiset of letters can be arranged into a palindrome exactly when at most one letter appears an odd number of times. Every other letter has to pair off symmetrically around the centre, and the single odd letter, if there is one, is the one that sits in the middle. So carrace works, because it has two c, two a, two r, and one e, and the e goes in the middle to give racecar. Silent does not, because all six of its letters appear once and only one of them can occupy the centre. This page runs that parity check on whatever you type, names the middle letter when there is one, and prints an arrangement that works so you can check the claim rather than take it on faith.

Do emoji and accented characters reverse correctly?+

Here they do, and it is worth knowing why that is not automatic. JavaScript strings are sequences of UTF-16 code units, so the usual one-line reversal, splitting a string into characters and reversing the array, corrupts anything that is not a single code unit. An emoji is a surrogate pair and comes back as two invalid halves. A flag is two regional indicators and comes back as a different flag or as nothing. An é written as e followed by a combining acute comes back with the accent attached to whatever letter now precedes it. Iterating code points instead fixes the first two and not the third, and it still shatters a ZWJ sequence such as 🧑‍🚀 into a person, an invisible joiner, and a rocket. This page segments into grapheme clusters, the units a reader would call characters, so all four cases survive the round trip. Try 🧑‍🚀 Never odd or even 🧑‍🚀 in the box.

How does it find the longest palindrome inside my text?+

With Manacher's algorithm, which finds the longest palindromic substring in time proportional to the length of the text. The obvious method is to treat every position as a possible centre and grow outward while the characters match, which is fine on ordinary prose and quadratic in the worst case: a string of ten thousand identical letters makes every centre expand almost the whole way. Manacher's insight is that the expansions already done tell you how far the next one can start, because a palindrome you are inside is a mirror and its left half predicts its right. The implementation here interleaves separators between the characters so that even-length and odd-length runs are found by the same loop, and it was checked against a brute-force search over thousands of random strings. That is why the page has no size ceiling for this answer and no slower fallback mode.

How much text can I check, and does any of it leave my browser?+

Each box takes up to 20,000 characters, roughly three thousand words, and none of it goes anywhere. There is no upload, no request, and no stored copy: every count on the page is computed in this tab by plain JavaScript, which is also why the page can say a string is a palindrome and can never say whether it is a word. The limit exists to keep a multi-megabyte paste from freezing the tab while it is being split into characters and drawn, not because any of the arithmetic is expensive. Within the limit everything is linear: counting letters, comparing the two frequency tables, testing the parity, and finding the longest palindromic run all take one pass. If you need a longer text, the question you are asking is almost certainly about one sentence inside it, so paste that.

More focused tools, ready when you are.

Explore the growing collection for calculations, documents, writing, and everyday work.

Browse all tools