Palindrome Checker

Check a word or phrase for palindrome: optionally ignore spaces, punctuation and case. Examples, algorithm walkthrough and common mistakes.

Everything runs in your browser — your data is never sent to any server.

Why bother checking whether a text is a palindrome

A palindrome is a string that reads the same from left to right and from right to left. "Level", "rotor", "never odd or even", the phrase "A man, a plan, a canal: Panama" - all of them are palindromes. The check takes a second, and it answers a question that otherwise forces you to flip the word over in your head. The task comes up wherever wording matters: wordplay in a headline, a name for a project or a brand, checking a number, or looking at a line of code that refuses to behave. There is one more plot worth mentioning: puzzles and quests where a palindrome hides the answer, and school assignments where you have to write the algorithm and then read someone else's solution.

What the checker does

  • Three independent switches: ignore spaces, punctuation and case
  • Reports the first mismatch and the positions of the characters that differ
  • Shows the normalized text that was actually compared
  • Handles Cyrillic, Latin and any other Unicode letters
  • Five ready-made examples one click away, including a phrase from the classics

How to check a phrase

  1. Paste the word or phrase into the field
  2. Tick what should be ignored: spaces, punctuation, case
  3. Press "Check for palindrome" and read the result
  4. If a mismatch is reported, look at the position and the two characters that differ

How the check works

The string is first normalized according to the rules you picked, then compared from both ends inward: one pointer starts at the first character, the other at the last, the characters under them are compared at every step, and as soon as they differ the search stops. If the pointers meet without finding a mismatch, the string is symmetric. The algorithm is linear, it makes a single pass and never copies the text, so checking a long document costs no more than reading it once. Pay attention to the normalization step, because that is where most of the arguments about whether something counts as a palindrome come from.

Examples: what is a palindrome and what is not

TextResultNotes
levelpalindromethree letters with mirrored ends
rotorpalindromesymmetrical without any settings
radarpalindromethe classic English example
never odd or evenpalindromeneeds space and case normalization
A man, a plan, a canal: Panamapalindromepunctuation has to go
Was it a car or a cat I sawpalindromeclassic punctuation-heavy line
racecarpalindromesame rule, same result
abcnot a palindromereversed it reads cba
palindromenot a palindromethe word does not equal its reverse
121 and 12321palindromenumbers obey the same rules

Where palindromes actually turn up

The best-known group of palindromes is the set of Russian phrases invented in the nineteenth century. "A rose fell on the lap of Azor" became the model of the genre: long, rhythmic, and unforgiving about letters and spaces. Nineteenth-century writers treated the genre as a failure, on the grounds that Russian simply could not produce one. They were half right: long Russian palindromes are nearly impossible without normalization, but with it they appear at once.

Palindromes live in engineering too. A palindromic DNA stretch is reverse-complementary to itself and serves as the point where replication restarts. In programming you run into palindromic patterns, numbers and strings, and in data analysis people look for them to understand the shape of a sequence. Vehicle registration numbers and phone numbers are a separate case: a symmetrical number looks tidier, and people pick it on purpose.

There are everyday uses that involve no science at all. A project name that reads the same from both ends is easier to remember. A riddle whose answer hides in a palindrome works on any audience. A barcode or an article number typed symmetrically is quicker to check by eye while someone is standing in a queue. The quickest way to try any of that is to use the example buttons under the form and watch them land in the input field.

  • Long phrases like "step on no pets" or "no lemon, no melon"
  • Names and handles you want to read from either end
  • Palindromic DNA stretches in bioinformatics
  • Symmetrical phone numbers and plate numbers
  • Palindromes in computer science assignments and contests
  • Puzzles and rebuses where the answer is hidden symmetrically

Why a palindrome does not always read the same

The main source of confusion is that normalization changes the very thing being checked. The string "Dovod dovod" contains a space, so a character-by-character comparison rejects it. Drop the space and you get "dovoddovod", and that is a palindrome. Formally you are looking at two different answers to one question, and which one is right depends on who is asking.

The second trap has to do with alphabets. Comparison is character-based, so "A" and "a" are different characters, and in Russian "yo" and "e" are different letters. A palindrome can fall apart over a single yo, and people rarely notice it by eye. If exact wording matters, keep the case rule on and run the check a second time with it off, so you know what the result actually rests on.

The third mistake is about language. An Arabic string read from right to left gives a different answer than a machine comparison going left to right. Arabic palindromes have traditionally been written and read in that direction, and the same text in Latin script looks different. This matters for signs, embroidery and inscriptions, where the reading direction is set by a person rather than by an algorithm.

  • A space inside a phrase breaks symmetry under a strict comparison
  • Case and the letter yo quietly wreck symmetry
  • Reading direction for Arabic and Hebrew inscriptions
  • An empty string is not a palindrome even though the algorithm will not reject it
  • One symmetric word does not make the whole sentence symmetric
  • A string of digits follows exactly the same rules

Walking through the algorithm on real examples

The algorithm keeps two pointers: one at the start of the string, one at the end. At each step the characters under them are compared, and once they differ there is no point in continuing, because that first mismatching pair already disproves the palindrome. If they match, both pointers move toward the centre. When they meet without finding a mismatch, the string is symmetric.

Walking through it this way shows where the answer comes from. The table below marks the exact position where the characters stopped agreeing. That position is the shortest stretch that makes the string fail, and everything before it does match. This is the level of detail you need when you have to explain a solution in a computer science class, not just print the verdict.

What happens at each step

StepActionOutcome
1NormalizationSpaces, punctuation and case are removed as requested
2Pointers at the edgesLeft on the first character, right on the last
3ComparisonThe characters under the pointers are matched
4MismatchThe position of the first difference is recorded
5ShiftPointers move inward while the characters agree
6MeetingThe pointers met, so the string is symmetric
7Empty inputNo verdict is shown, some text is required
8Re-runChanging a setting recalculates the result

The check makes a single pass over the string, so long text does not slow the tool down.

Palindromes in numbers, in code and on labels

Numeric palindromes are easy to spot by eye: 121, 12321, 45654. There is arithmetic structure behind them too: the more digits a number has, the more of them qualify, and from five digits upwards there are dozens per hundred. That is why palindromes show up in brute-force exercises and in contest problems about divisibility, where the shape of the number gives you the idea.

In code, palindromes turn up as coincidences, and they are regularly spotted in logs, test fixtures and generated identifiers. When you run across one, look at the surroundings first: spaces, dashes and letter case explain most findings. It also helps to know how numbers behave in other bases, and for that there is a number base converter plus a longer piece on the binary code.

  • Numbers: 121, 12321, 45654, recognizable without any algorithm
  • Code and logs: unexpected symmetry usually comes from formatting
  • Article numbers and barcodes: checkable by eye, without a program
  • Names and handles: readable from both ends saves the explaining
  • Random strings: if there is a match, run it again without normalization

Frequently asked questions

What counts as a palindrome

A string whose sequence of characters matches its reverse. Practice disagrees on exactly one point: whether spaces, punctuation and case should be taken into account. The strict version requires a character-for-character match, so "A rose fell on the lap of Azor" is not a strict palindrome: the letters differ in case and there are spaces. In human tasks the normalized version is almost always what is meant, and that is exactly what the switches above let you test.

How is a palindrome different from a reversed string

A palindrome equals itself when read backwards, while a reversed string is simply any string read from the other end. "Dovod dovod" is a palindrome because it reads the same both ways. "ABC" is a reversed string but not a palindrome: read backwards it gives "CBA". The distinction matters when you scan random strings for symmetry and want to weed out the coincidences.

What should I do about spaces and punctuation

It depends on the task. For a word or a name, dropping the spaces and folding the case is usually enough. For a phrase you almost always need all three rules, otherwise the answer is misleading. If you are unsure, run the text twice: first with the case rule only, then with all three. If the answers differ, you are looking at a coincidence after normalization rather than a true palindrome, and it is worth saying so out loud.

Is a single letter a palindrome

Yes, mathematically a one-character string equals its reverse. In practice, checking an empty string or a single character rarely makes sense, so the form requires a non-empty input. Numbers follow the same logic: 121, 12321 and 45654 read the same from both ends, and this tool finds them with the same rules.

Are there Russian palindrome words

There are plenty: "ded", "abba", "topot", "shabash", "ara", and the two-word "dovod dovod". A separate classic of Russian literature is the phrase "A rose fell on the lap of Azor", usually cited as the model of a perfect palindrome. Longer ones exist too, such as "Kto hodit k vam, hodit i k nam". You can test any of them right here: the example buttons drop the text straight into the field.

Can a palindrome be found inside a large text

Yes, and there is a dedicated technique for it: Manacher's algorithm finds every palindromic substring in linear time, while the palindrome algorithms of Boyer and Moore search the whole string for the longest one. In practice it is easier to split the text into words and check them one by one, because then you find actual palindrome words rather than accidental matches inside sentences.

Does this help with phone numbers and plate numbers

For vanity numbers such as 8-800-777-67-89, yes: the check shows whether the number reads the same from both sides. VIN codes work differently, they are 17-character identifiers with a check digit and symmetry plays no part in them. If you want to confirm that a number or code looks tidy, start by removing the separators with the whitespace and separator remover, then check the symmetry here.

Where else is knowing about palindromes useful

In computer science assignments, in puzzles and quests, when picking a name for a project, and in decoding rebuses and acronyms. Palindromic DNA deserves a mention of its own: reverse-complementary stretches form palindromes and act as replication origins, so in bioinformatics the term is working vocabulary rather than a party trick. If you lean towards the mathematical side, read about number base conversion and the binary code explained.

Related articles

Related tools