Text Reverser
Last updated: 27 June 2026
Reviewed by Gavin Meiring, Lead research and primary author ยท Doctoral Candidate (Corporate Governance) ยท Research and drafting assisted by AI
- The Sator Square โ 'SATOR AREPO TENET OPERA ROTAS' โ is a Latin palindrome that reads the same in every direction, and copies of it were buried in Pompeii before the eruption of 79 AD.
- Leonardo da Vinci wrote most of his notebooks in mirror writing, so his private notes appear backwards unless read in a mirror โ scholars still debate exactly why.
- The word 'palindrome' comes from the Greek 'palin dromein', meaning 'to run back again', and the classic 'A man, a plan, a canal โ Panama!' was coined by Leigh Mercer in 1948.
Text Reverser
A text reverser flips your input so that the last character becomes the first, producing a mirror image of the original text. It is used by puzzle creators, developers testing string manipulation, teachers demonstrating algorithms, and anyone who enjoys wordplay and hidden message effects.
How to Use the Text Reverser
- Type or paste the text you want to reverse into the input field.
- Choose whether to reverse the entire string character by character, or to reverse the order of words while keeping each word intact.
- Click the reverse button.
- The tool displays the reversed output below.
- Copy the result for use in your project, puzzle, or creative work.
The Formula
Reversing a string is one of the most fundamental operations in computer science. The algorithm works by iterating through the characters of the input from the last position to the first, building a new string in that order.
In pseudocode:
- Read the input string.
- Start from the final character and move backwards to the first.
- Append each character to a new output string.
- Return the output string.
For "hello", the positions are h(0), e(1), l(2), l(3), o(4). Reading from index 4 to 0 gives "o", "l", "l", "e", "h", producing "olleh".
A word-order reversal applies the same logic at the word level: split the input by spaces, reverse the array of words, then rejoin with spaces. "The quick brown fox" becomes "fox brown quick The".
Real-World Example
A puzzle designer wants to hide a message in a poster. The message is "Meet at the library at noon". Reversed character by character, it becomes "noon ta yrarbuil eht ta teeM". When printed backwards on a transparency and held up to a mirror, the original message is revealed. The text reverser produces this output instantly without manual counting.
Where Text Reversal Is Used
Beyond puzzles, text reversal has practical applications in software development. Programmers use it to test whether their string-handling code works correctly, to implement palindrome checkers, and to process data that arrives in reverse order (such as certain financial ledgers or stack-based structures). In typography and graphic design, reversed text is used for mirror-image watermarks and artistic effects. Some languages, such as Arabic and Hebrew, are written right to left, and text reversal tools can assist in testing how interfaces handle bidirectional text rendering.
Frequently Asked Questions
Does the text reverser work with special characters and punctuation? Yes. A character-by-character reversal treats every character, including spaces, punctuation marks, and numerals, as part of the sequence. A comma at position 5 in the original will appear in the corresponding reversed position in the output.
What is the difference between reversing characters and reversing words? Reversing characters flips every individual character, so "Hello world" becomes "dlrow olleH". Reversing word order keeps each word intact but flips their sequence, giving "world Hello". Most text reversers offer both options.
Can I use this to create a palindrome? You can use the reversed output to check for palindromes: if the reversed string matches the original (after normalising case and removing spaces), the input is a palindrome. However, the text reverser alone does not create palindromes from arbitrary text.
Is text reversal the same as encryption? No. Text reversal is a trivial conversion that anyone can decode instantly by reversing the string again. It is not a secure method of hiding information and should not be used in place of proper encryption for any sensitive data.
The four reversal modes
Four ways to reverse the same input sit behind the mode selector, and they behave differently as soon as the input has more than one line. Take this input, with a line break between the two rows:
one two three four five six
| Mode | Output | | Characters | xis evif ruof eerht owt eno | | Words | six five four three two one | | Lines | four five six, then one two three | | Words in each line | three two one, then six five four |
Word mode splits on any run of whitespace and rejoins with single spaces, so the line break disappears and the whole input becomes one line. Lines mode keeps the line breaks and reverses their order. The fourth mode reverses the words inside each line and leaves the line order alone. Which one is right depends on whether the breaks carry meaning. A reversed list of addresses keeps its lines. A reversed sentence does not.
Where reversal breaks: code units and code points
Reversal is a one-line operation in most languages, and the obvious one-line version is wrong for a specific class of input. In JavaScript, split('') divides a string into UTF-16 code units rather than characters. A character outside the basic multilingual plane, such as the grinning face at U+1F600, occupies two code units. Reversing the two halves produces two lone surrogates, which are not valid text and render as two replacement characters.
| Input | Code units | Code points | Reversed by code unit | Reversed by code point | | A, then U+1F600, then B | 4 | 3 | B, then a low surrogate, then a high surrogate, then A | B, then U+1F600, then A |
The fix is to iterate by code point, using Array.from or the spread operator in place of split(''). That handles the astral character case. It does not handle combined characters. An "e" followed by a combining acute accent is two code points that render as one letter, and reversing the two leaves the accent dangling before the letter. A character is only safe to move as a unit when it is a single code point, or when the sequence has been normalised first. Normalising to NFC composes the e and the accent into the single precomposed character and removes that problem for inputs that have a composed form. Grapheme clusters with no composed form, such as a flag or a family sequence, need a segmentation step rather than a simple code point iteration.
Reversal as a palindrome test
The most reliable use of a character reversal is checking whether a string reads the same in both directions. Normalise the input by lowercasing it and dropping everything that is not a letter or a digit, then compare the result with its own reversal.
| Input | Normalised | Palindrome | | Never odd or even | neveroddoreven | yes | | A man, a plan, a canal: Panama | amanaplanacanalpanama | yes | | Drawer | drawer | no |
The first two come back unchanged once the spaces and punctuation are gone. "Drawer" does not, which is why the word appears in poetry about mirror writing: its reversal gives "reward", and the pair is a well-known near miss rather than a palindrome.
Reversing text in other scripts
Reversing a string of Arabic or Hebrew text produces what appears to be the correct visual order, and the appearance misleads. The Unicode Bidirectional Algorithm decides how mixed-direction text is displayed, and it works from the logical order of the characters. A string reversed to fix its appearance carries the wrong logical order, so it breaks as soon as anything searches it, copies it, or applies the algorithm itself. Test bidirectional rendering by setting the text direction property or using a right-to-left locale, and leave the characters in their logical order.
What the length figures mean
The result panel reports the length of the input and of the output in characters. For plain ASCII text the two match, because reversal moves characters without adding or removing any. They part company in two situations. Reversing a string that holds a character outside the basic multilingual plane by code unit can split it, and the count shown then does not match what a reader sees. Word mode also changes the count when the input has a double space or a trailing space, because it splits on any run of whitespace and rejoins with a single space.
Compare the two numbers against each other on any input that holds accented letters, a character beyond the basic plane, or unnaturally spaced words. A difference is not an error by itself, and it does point at the part of the input the reversal treated as more than one unit.
What reversal does to a number
Reversal works on characters, and characters that happen to form a number stop behaving like one once their order changes. The digits of 1200 reversed give 0021, which reads as 21 unless the leading zeros are kept as text.
| Input as text | Reversed | Reads as | | 1200 | 0021 | 21 | | 1500 | 0051 | 51 | | 90 | 09 | 9 |
The same applies to a date written as 2026-09-14, which reverses to 41-90-6202, and to a currency figure. Reversal moves characters and never changes the value they stand for, so a reversed numeral is a different numeral rather than a rounding of the original.
A reversal you can check by hand
Reversing "hello" by hand confirms what the character mode is doing. The letters occupy positions 0 to 4: h at 0, e at 1, l at 2, l at 3, o at 4. Reading them from 4 back to 0 gives o, l, l, e, h, which is "olleh".
| Input | Characters | Reversed | Characters out | | hello | 5 | olleh | 5 | | The quick brown fox | 19 | xof nworb kciuq ehT | 19 | | Meet at the library at noon | 27 | noon ta yrarbil eht ta teeM | 27 |
Every row has the same count on both sides, because a character reversal moves characters without adding or removing any. A row where the two counts differ points at an input the tool treated as more than one unit, which is the surrogate case described above.
Also try these free tools: