回文检查器
检查单词或短语是否正向和反向读法相同,支持忽略大小写和标点符号的选项。
关于此工具
输入任意单词或句子,即时判断是否为回文。切换选项以忽略空格、标点符号和字母大小写,实现灵活匹配。工具还会找出输入中最长的回文子串,逐词检查,并提供著名回文示例供您尝试。
使用方法
- 1 是的,对于多词输入,工具会将文本分割为单独的词语并逐一检查,为每个词语显示通过/失败徽章。
- 2 在输入框中输入或粘贴文本。
- 3 根据需要切换忽略空格、标点符号和/或字母大小写的选项。
- 4 查看结果徽章——"回文"或"非回文"——以及反转后的文本。
What counts as a palindrome — and what gets ignored
A palindrome reads the same forwards and backwards. The catch is deciding which characters "count." The word racecar is obviously symmetric, but a phrase like "A man, a plan, a canal: Panama" is only a palindrome if you throw away the spaces, the comma, the colon, and the difference between uppercase and lowercase. That normalisation step is the entire art of palindrome checking, and this tool lets you control it with three switches: ignore case, ignore spaces, and ignore punctuation. With all three on, the checker first lowercases the text, strips whitespace, then removes every character that is not a letter or digit, and only then compares the cleaned string against its reverse.
This matters because the same input can be a palindrome under one setting and not another. Turn ignore case off and Madam fails, because capital M is not equal to lowercase m. The default is to ignore all three, which matches how people normally think about word and phrase palindromes.
A worked example
Paste Was it a car or a cat I saw? with the default options on. The tool normalises it to wasitacaroracatisaw (19 characters), reverses that to the identical string, and shows a green Palindrome ✓ badge along with the reversed text so you can see exactly what was compared. Now type a multi-word phrase that is not a palindrome, such as hello world. You still get useful output: the word-by-word check appears, tagging each word green if it is itself a palindrome, and a longest palindrome found within input line reports the longest symmetric run inside your text. For hello world that would be ll; for a longer body of text it might surface a hidden gem like noon or level you never noticed.
How the "longest palindrome inside" feature works
Finding the longest palindromic substring is a classic computer-science problem. This tool uses centre expansion: it walks through every position in the normalised string, treats it as the middle of a potential palindrome, and grows outward one character at a time while the left and right sides keep matching. It checks both odd-length centres (a single character) and even-length centres (a gap between two equal characters), keeping the longest match it finds. That is why even an input that is not a palindrome overall can still report a meaningful internal one.
Practical use cases
- Wordplay and puzzles. Crossword setters, Scrabble players, and constructors of recreational-maths puzzles use a checker to verify candidate palindromes quickly instead of reversing strings by hand.
- Teaching programming. "Write a function that detects a palindrome" is one of the most common beginner coding exercises. Seeing the normalised string and the reversal side by side helps learners understand why case-folding and stripping punctuation are separate decisions.
- Naming and branding. Palindromic names (think level, civic, aviva) are memorable and look the same in a mirror, which designers sometimes exploit for logos.
- Data validation curiosity. Checking whether an ID, a date format, or a generated code happens to be palindromic is a quick sanity check the tool answers instantly.
Common mistakes and edge cases
- Forgetting that an empty or single-character string is trivially symmetric. The tool requires at least one character before declaring a match, so a blank box returns nothing rather than a misleading "yes."
- Expecting accented letters to be normalised. The punctuation filter keeps only basic
a–z,A–Z, and0–9. A character likeéis treated as punctuation and removed when "ignore punctuation" is on, which can change the result of non-English phrases — worth knowing before you trust a verdict on accented text. - Confusing word-level and phrase-level checks. A sentence can fail overall while several individual words pass. The word-by-word panel exists precisely to show that distinction.
- Assuming numbers are excluded. Digits count.
12321is a palindrome here, which is handy for checking numeric palindromes and palindromic years.
Try the famous examples
Below the input you will find a row of classic palindromes — racecar, Never odd or even, Do geese see God, Step on no pets, and others — each as a clickable button that loads the phrase and runs the check immediately. They are a fast way to see how the case, space, and punctuation switches change the outcome on real sentences. Everything runs entirely in your browser; the text you type is never sent anywhere, so you can paste private notes or unpublished names without concern.