Palindrome Checker

Check if text is a palindrome with options to ignore spaces, case and punctuation

What is it and how does it work?

A palindrome is a word, phrase, or sequence that reads the same forwards and backwards. "racecar", "level", "madam", and "A man a plan a canal Panama" are all palindromes. The simplest check reverses the input string and compares it to the original — if they match, it's a palindrome. But meaningful palindrome checking for phrases requires normalising the input first: removing spaces, punctuation, and ignoring case so that "A man, a plan, a canal: Panama!" correctly identifies as a palindrome.

Palindrome checking appears in competitive programming, bioinformatics (DNA sequences like ATCGCGCGCGAT are palindromic), and as a classic introductory problem for string manipulation and recursion. This tool checks any input for palindrome status, shows the cleaned comparison string, and handles Unicode — including characters with diacritics.

Common use cases

Frequently asked questions

How is a palindrome check implemented for phrases?

The standard approach: (1) convert to lowercase, (2) remove all non-alphanumeric characters using a regex like /[^a-z0-9]/g, (3) reverse the resulting string, (4) compare original cleaned string to reversed. If equal, it's a palindrome. The reversal uses Array.from() (not string split) to handle multi-byte Unicode correctly.

Are there palindromes in DNA?

Yes — but "palindrome" means something different in molecular biology. A DNA palindrome is a double-stranded sequence where the complement of the 5'→3' strand reads the same in the 5'→3' direction. For example, GAATTC (the EcoRI restriction enzyme recognition site) is a DNA palindrome. These are important for restriction enzyme binding.

What is the longest known palindrome in English?

There's no definitive answer since anyone can construct long palindromes. The famous "A man, a plan, a canal: Panama" was extended to thousands of words. The longest naturally occurring single-word palindromes in English include "tattarrattat" (James Joyce, 12 letters) and "redivider" (9 letters).

How do I find all palindromic substrings of a string?

The naive approach is O(n³). Manacher's algorithm finds all palindromic substrings in O(n) time by exploiting the mirror properties of palindromes around a centre point. For competitive programming, Manacher's is the standard palindrome substring algorithm.

Text

Uppercase / Lowercase · Word Counter · Character Counter · Lorem Ipsum Generator · Remove Extra Spaces · Sort Text Lines