Text Reverser - Reverse Characters, Words and Lines Safely
Reverse a piece of text five ways: all the characters, the order of the words, each word on its own, the order of the lines, or each line on its own.
Maintained by Hirantha Sandaruwan Lakshan. Updated 13 October 2026.
About this tool
By default a character means what a reader sees as one character, so a letter with its accent, an emoji with its skin tone, a family emoji and a Sinhala or Tamil letter with its vowel signs are never torn apart. You can switch to code points or UTF-16 units to see what goes wrong. Upside-down and mirrored lettering is not done here.
How it works
Why plain reversal breaks text. JavaScript strings are sequences of UTF-16 code units, and the usual one-line trick of splitting, reversing and joining works on those units. An emoji such as U+1F600 takes two units (D83D then DE00), so reversing units puts its halves in the wrong order and shows a broken character. Reversing by code point fixes that, but a letter plus a combining accent is two code points, and reversing them moves the accent onto the wrong letter.
Three meanings of character. A UTF-16 unit is what String.length counts. A code point is one Unicode value, such as U+0065 for e or U+0301 for the combining acute accent. A grapheme cluster is what a reader sees as one character, as defined by the Unicode text segmentation rules (UAX #29). The table below counts the same text all three ways. A family emoji is 1 cluster, 7 code points (four emoji and three zero width joiners) and 11 UTF-16 units. The letter e followed by U+0301 is 1 cluster, 2 code points and 2 units. The single code point U+00E9 is 1 in every count.
This tool reverses grapheme clusters, using Intl.Segmenter in the browser and a simpler approximation in browsers that lack it. Sinhala needs one extra step. A consonant, the al-lakuna, a zero width joiner and a second consonant form a conjunct, such as the one written U+0D9A U+0DCA U+200D U+0DC2 (4 code points, 4 units). The Unicode rules cut that after the joiner, so the tool joins the pieces back into one unit. Without the joiner an al-lakuna is a visible hal kirima and the next consonant is a separate letter. Tamil vowel signs and the pulli stay with their consonant.
The five modes. Reverse all characters writes the whole text backwards, line breaks included, and a Windows line break (CR LF) stays a pair. Reverse word order swaps the words in each line and leaves the spacing as it was. Reverse each word writes every word backwards in place, so punctuation stuck to a word is reversed with it. Reverse line order puts the last line first and keeps one final line break at the end. Reverse each line writes every line backwards and keeps the lines in order.
Worked examples
Hello, world! in three modes
Reverse all characters gives !dlrow ,olleH. Reverse word order gives world! Hello,. Reverse each word gives ,olleH !dlrow, because the comma and the exclamation mark are stuck to their words and travel with them.
Lines
Take the three lines one, two and three. Reverse line order gives three, two, one. Reverse each line keeps the order and writes eno, owt, eerht.
An accent stays on its letter
Type e, U+0301 and a. Reversed by grapheme clusters the result is a followed by e with its accent, so the accent stays on the e. Reversed by code points the result is a, U+0301, e, and the accent now sits on the a.
Half an emoji
U+1F600 is stored as the two UTF-16 units D83D and DE00. Reversing by UTF-16 units writes DE00 then D83D, two halves in the wrong order that a browser shows as broken characters. The tool warns you when that happens.
The same text counted as UTF-16 units, code points and grapheme clusters
| Text | Code points | UTF-16 units | Code point count | Grapheme clusters |
|---|---|---|---|---|
| a | U+0061 | 1 | 1 | 1 |
| e plus a combining acute accent (é) | U+0065 U+0301 | 2 | 2 | 1 |
| e with acute as one code point (é) | U+00E9 | 1 | 1 | 1 |
| U+1F600, one emoji | U+1F600 | 2 | 1 | 1 |
| Thumbs up with a skin tone modifier | U+1F44D U+1F3FD | 4 | 2 | 1 |
| Flag of Sri Lanka, two regional indicator letters | U+1F1F1 U+1F1F0 | 4 | 2 | 1 |
| Family of four, joined by zero width joiners | U+1F468 U+200D U+1F469 U+200D U+1F467 U+200D U+1F466 | 11 | 7 | 1 |
| Sinhala ka with the vowel sign i (කි) | U+0D9A U+0DD2 | 2 | 2 | 1 |
| Sinhala conjunct (ක්ෂ), as joined by this tool | U+0D9A U+0DCA U+200D U+0DC2 | 4 | 4 | 1 |
| Tamil ta with the vowel sign i (டி) | U+0B9F U+0BBF | 2 | 2 | 1 |
| Tamil la with a pulli (ழ்) | U+0BB4 U+0BCD | 2 | 2 | 1 |
Frequently asked questions
Does it reverse emoji correctly?
Yes, with the default setting. Emoji sequences such as a family, a flag or a thumbs up with a skin tone are single grapheme clusters, so they move as one piece. If you choose UTF-16 units the tool shows a warning, because that setting can cut an emoji in half.
What is a grapheme cluster?
It is the Unicode term for what a reader sees as one character. It can be one code point, or a base letter with combining marks, or an emoji sequence. The rules are in Unicode Standard Annex #29, and browsers expose them through Intl.Segmenter.
Why does reversed Sinhala or Tamil still look strange?
The tool keeps each letter with its vowel signs, but reversing changes the order of the syllables, and a word read backwards is rarely a word. For a conjunct joined with a zero width joiner, the pieces move as one unit, so the letter itself is never damaged.
Can it flip text upside down or mirror it?
No. Upside-down text swaps letters for look-alike characters from other scripts, and mirrored text does the same with reversed shapes. That is a different job. This tool only changes the order of the text.
What happens to line breaks?
Reverse all characters reverses them with everything else, and a CR LF pair stays a pair. The two line modes and the word modes keep the line breaks exactly where they are, and Reverse line order uses the first kind of line break it finds.
Does the word order mode work across lines?
No. It swaps the words within each line, so the lines stay where they are. To reverse whole lines use Reverse line order.
Is my text uploaded?
No. The reversal is done in your browser tab and nothing is sent to a server.
Sources & references
Updated Oct 13, 2026