Reverse Text
Why most reversers break emoji
The obvious way to reverse a string in JavaScript is
s.split('').reverse().join(''), and it is wrong. It splits by UTF-16 code unit, and an
emoji is usually two of them. Reversed, the pair is separated and the browser draws two replacement
squares instead of the emoji.
Devanagari has the same problem for a different reason: a matra is a separate character that attaches to the consonant before it. Reverse them individually and every syllable comes apart. This tool splits on grapheme clusters — what a reader would call a character — so both survive.
The four modes
- Character — "Hello there" becomes "ereht olleH".
- Word — words stay intact, their order flips: "there Hello".
- Line — line order flips, each line untouched. Usually what you want for a list.
- Words within each line — each line's words flip, lines stay in order.
It is not a cipher, and not right-to-left
Reversed text is readable in a second and takes one click to undo, so it hides nothing. It is also not the same as right-to-left display: Arabic and Hebrew are already written right-to-left, and reversing them scrambles the words rather than making them read normally.
Share this tool with friends
Free to use, no sign-up, works on any phone.
Frequently Asked Questions
Because they split the string with .split("") which works one UTF-16 code unit at a time, and an emoji is usually two of them. Reversed that way the pair comes apart and you get two replacement squares. This splits by character rather than by code unit, so emoji survive.
Devanagari is written with combining marks — the matra attaches to the consonant before it. Reversing by raw character would detach every one of them. Here the text is split on grapheme clusters where the browser supports it, so a syllable stays whole.
By character turns "Hello there" into "ereht olleH". By word keeps each word intact and flips the order: "there Hello". By line reverses the order of lines and leaves each line untouched, which is what you usually want for a list.
No. It is trivially readable and reversing it back takes a second. It is a novelty or a puzzle, not a way of hiding anything.
No — it produces the characters in the opposite order, which is not the same as displaying text right-to-left. Arabic and Hebrew are already right-to-left and reversing them scrambles the words.
No.