# Text Reverser - Reverse Characters, Words and Lines Safely

Page: https://hirantha.me/tools/text-reverser
Part of: Hirantha Sandaruwan Lakshan free tools (https://hirantha.me/tools)
Updated: 2026-10-13

Reverse text by characters, words or lines without breaking emoji, accents or Sinhala and Tamil letters, and see how code points differ from UTF-16 units.

This is a free tool that runs in the browser: open the page to use it. File tools process files on the visitor's own device; files are never uploaded or stored. No account, sign-up, payment or watermark.

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. 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.

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.

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 (é) | 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 |

Q: Does it reverse emoji correctly?
A: 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.

Q: What is a grapheme cluster?
A: 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.

Q: Why does reversed Sinhala or Tamil still look strange?
A: 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.

Q: Can it flip text upside down or mirror it?
A: 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.

Q: What happens to line breaks?
A: 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.

Q: Does the word order mode work across lines?
A: No. It swaps the words within each line, so the lines stay where they are. To reverse whole lines use Reverse line order.

Q: Is my text uploaded?
A: No. The reversal is done in your browser tab and nothing is sent to a server.

Sources: Unicode Standard Annex #29: Unicode Text Segmentation (grapheme clusters) (https://unicode.org/reports/tr29/); Intl.Segmenter, MDN Web Docs (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter); String length (UTF-16 code units), MDN Web Docs (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length); The Unicode Standard 18.0, chapter 13: Sinhala (https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-13/)

Related tools:

- [Case converter](https://hirantha.me/tools/case-converter.md): Convert text to uppercase, lowercase, title case, or camelCase.
- [Word & character counter](https://hirantha.me/tools/word-counter.md): Live word, character, sentence, and reading-time counts as you type.
- [Find and replace text](https://hirantha.me/tools/find-and-replace-text.md): Find and replace in pasted text with plain or regular expression matching, whole word and case options, several rules in order, a live match count and undo.
- [Palindrome checker](https://hirantha.me/tools/palindrome-checker.md): Check whether a word, phrase or number reads the same backwards. Ignore case, spaces and punctuation, see the first mismatch and find the longest palindrome inside.
