How does reversing text work?
Reversing text means writing its characters in the opposite order, so the last character comes first. This tool does it live as you type: stressed becomes desserts, and Hello, world! becomes !dlrow ,olleH. It works on whole Unicode characters rather than bytes, so most emoji survive, but symbols built from several characters, like flags and skin tones, can come apart.
Using the reverser
- Type or paste your text into the input box.
- Watch the output update as you type. There's nothing to configure.
- Click Copy to take the reversed text.
What gets reversed
Everything is one long sequence, including spaces, punctuation and line breaks. That has a consequence people don't always expect with multi-line input: the line order flips as well as the letters.
| Input | Output |
|---|---|
stressed |
desserts |
Hello, world! |
!dlrow ,olleH |
I ๐ JS |
SJ ๐ I |
line one, then line two on the next line |
owt enil, then eno enil |
If you wanted each line reversed in place, or the words reversed but kept readable, this isn't the tool for it; it treats the whole input as a single string.
Where Unicode trips it up
Under the hood, text in JavaScript is stored as UTF-16, where characters outside the basic range, including most emoji, take two 16-bit units. A naive str.split('').reverse() splits those pairs and produces broken "๏ฟฝ" characters. This tool iterates by code point instead, so a single-code-point emoji like ๐ reverses intact.
What a reader sees as one character can still be several code points. Unicode calls that unit a grapheme cluster and defines the rules in UAX #29, Text Segmentation. Reversing code points splits those clusters:
| Input | What it's made of | Reversed output |
|---|---|---|
| รฉ (precomposed) | 1 code point, U+00E9 | รฉ, unchanged |
| รฉ (decomposed) | e + U+0301 combining acute | Accent lands before the e, on the wrong letter |
| ๐๐ฝ | Thumbs up + skin-tone modifier | ๐ฝ๐, a colour swatch then a yellow thumb |
| ๐ฎ๐ณ | Regional indicators I + N | ๐ณ๐ฎ, the flag of Nicaragua |
| ๐จโ๐ฉโ๐ง | Three people joined by zero-width joiners | ๐งโ๐ฉโ๐จ, the family drawn in a different order |
The flag case is the strangest. A flag emoji is just two letters from a special alphabet spelling an ISO country code, and reversing the letters spells a different code. Canada (CA) turns into Ascension Island (AC), and the US (US) becomes SU, which most systems show as two letter boxes because it isn't a current country code.
Reversing by grapheme in your own code
If you're writing a reverse function yourself, for an interview question or a real feature, reverse grapheme clusters rather than code points. Modern JavaScript has Intl.Segmenter for exactly this:
const reverse = (text) =>
[...new Intl.Segmenter('en', { granularity: 'grapheme' }).segment(text)]
.map((part) => part.segment)
.reverse()
.join('');
reverse('Hi ๐๐ฝ ๐ฎ๐ณ'); // "๐ฎ๐ณ ๐๐ฝ iH"
That keeps skin tones, flags, families and decomposed accents together. Normalising with text.normalize('NFC') first also helps with accents, because it turns e plus a combining acute back into a single รฉ. The JavaScript overview covers strings and iteration if you want the background.
Things to do with reversed text
- Check a palindrome. A phrase is a palindrome if it reads the same both ways. For phrases like "Never odd or even", strip the spaces and lowercase it first with the case converter, then compare the reversal with the original.
- Mirror writing and puzzles. Backwards text is a cheap cipher for treasure hunts and escape-room clues.
- Inspect tricky characters. If a reversal looks wrong, paste the original into text to hex to see its UTF-8 bytes and spot hidden combining marks.
For text that looks rotated rather than mirrored, the upside down text generator reverses the order and swaps in flipped look-alike characters.
Last updated