Saved

Press the star next to a tool's name to save it.

All my tools

Palindrome Checker

This palindrome checker tests a word, number or sentence, can ignore case, spaces and punctuation, shows the cleaned text and its reverse, and finds the longest palindrome hidden inside.

Restored your last values ·

Letters and digits in any script are compared. Accents are not removed.

Everything is worked out in your browser. Nothing you type is sent anywhere.

Result

Type some text and press Check.

Recent results

A palindrome checker tells you whether a word, number or sentence reads the same backwards as forwards, and shows exactly what it compared. This palindrome checker can ignore case, spaces and punctuation, shows the cleaned text and its reverse side by side, and also finds the longest palindrome hidden inside your text, which is useful for puzzles, programming exercises and word games.

What counts as a palindrome

A palindrome is a word, number, phrase or other sequence of symbols that reads the same backwards as forwards. [1] Familiar examples are madam and racecar, the date 22/02/2022, and the sentence A man, a plan, a canal – Panama. [1] For sentences, punctuation, capitalization and spaces are usually ignored, which is why Do geese see God? and Was it a car or a cat I saw? count as palindromes. [1] The word itself was introduced by Henry Peacham in 1638 from the Greek words for again and direction. [1]

The longest single-word palindrome in everyday use is the 19-letter Finnish word saippuakivikauppias, and the longest in English is the 12-letter tattarrattat, coined by James Joyce. [1]

How the checker works

  1. Your text is read as it is typed. If you tick the option to ignore spaces and punctuation, everything that is not a letter or digit in any script is removed.
  2. If you tick the option to ignore case, what remains is lower-cased, so Madam and madam match.
  3. The cleaned text is compared with its own reverse, character by character from both ends towards the middle. Every pair must match.
  4. The cleaned text and its reverse are shown, so you can see at a glance where a failed attempt breaks down.
  5. A separate search then looks for the longest palindrome inside the cleaned text, even if the text as a whole is not one.

Both options are ticked by default, which is the usual convention for sentences. Untick them for a strict test, where every space, comma and capital letter must match too. Under the strict test Madam is not a palindrome, because the capital M differs from the lower-case m at the other end, while madam is.

Worked examples

InputOptionsCleaned textPalindrome?
Never odd or evencase and punctuation ignoredneveroddorevenYes
A man, a plan, a canal: Panama!case and punctuation ignoredamanaplanacanalpanamaYes
MadamstrictMadamNo
madamstrictmadamYes
hello worldcase and punctuation ignoredhelloworldNo

The longest palindromic substring

Even when your text is not a palindrome, it may contain one. The longest palindromic substring problem asks for a maximum-length contiguous stretch of a string that is itself a palindrome. [2] For example, the longest palindromic substring of bananas is anana, and abracadabra has two of length three, aca and ada, and none longer. [2] It should not be confused with the longest palindromic subsequence, which allows letters to be skipped. [2]

There are several ways to find it. Manacher invented a linear-time algorithm in 1975, and later solutions by Jeuring and Gusfield also run in linear time. [2] The simpler method treats every character, and every gap between two characters, as a possible centre and expands outwards while the letters match, which takes time proportional to the square of the length. [2] This checker uses that simpler centre-expansion method, which is fast enough for the passages people paste in, and reports the first longest palindrome when there is a tie. If the longest palindrome is a single letter the tool says that no palindrome longer than one character exists.

Uses for a palindrome checker

  • Checking wordplay, puzzle answers and crossword clues quickly.
  • Verifying programming exercises, where reversing a string and comparing is a classic interview question.
  • Testing dates such as 02/02/2020, which reads the same in several formats.
  • Finding hidden palindromes inside names, slogans or passages for writing games.
  • Teaching string symmetry and the idea of comparing from both ends.

Numbers and dates

Digits count as characters, so 12321 and 1001 pass the test, and a date written as 02/02/2020 reads the same once the slashes are ignored. [1] Universal Palindrome Day, 2 February 2020, reads the same in year-month-day, day-month-year and month-day-year order. [1] Paste a date in different formats and compare the cleaned text to see which ones work, remembering that the cleaned text is only digits.

Palindromes in other languages

The idea works in any alphabet, because the comparison uses whole characters rather than bytes. The Finnish saippuakivikauppias and the Latin square sator arepo tenet opera rotas are well-known examples, and a Byzantine Greek sentence about washing sin from the fourth century is another. [1] Languages with accents may need pre-processing before a test makes sense, since this checker does not remove accents.

Things to watch for

Letters are compared as written, so an accented letter is different from its plain form: the checker does not strip accents, which means a word that is a palindrome only after accents are removed will fail. Digits are treated like letters, so 12321 passes. Emoji and other symbols are kept when you choose the strict test and removed when you ignore punctuation. Text is limited to twenty thousand characters, and nothing you enter leaves your browser.

If you need the opposite operation, writing text backwards so you can build a palindrome by hand, the reverse text generator does that. For counting the letters in a candidate sentence, use the word counter.

What next

Use this often? Add Palindrome to your Home screen.

Frequently asked questions

What is a palindrome checker?

It is a tool that tests whether text reads the same forwards and backwards. This one can ignore case, spaces and punctuation and shows the cleaned text and its reverse.

Does a palindrome checker ignore spaces and punctuation?

Yes, when the option is ticked, which is the normal convention for sentences. Untick it for a strict test where every character must match.

Is a single letter or number a palindrome?

Yes. Any single character reads the same in both directions, so the checker reports it as a palindrome.

How does it find the longest palindrome inside my text?

It treats every character and every gap as a centre and expands outwards while the letters match, then keeps the longest stretch it found.

Are accented letters treated as the plain letter?

No. Letters are compared exactly as written, so an accented letter does not match its unaccented form.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Text & Writing Tools