piapia123
en

Reverse Text

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Reversing text is ambiguous, and the four readings give entirely different results: `abc` becomes `cba` (within each line), the first line becomes the last (line order), the whole text is turned around including its line breaks (whole text), or `one two` becomes `two one` (word order). So this tool offers four separate options rather than one Reverse button — guessing wrong costs you another paste. It reverses by grapheme cluster, not by code unit. `"👍🏽".length` is 4: an emoji with a skin-tone modifier takes four UTF-16 code units. Reversing those units yields two lone surrogates and the screen shows `��`. Reversing by code point fixes surrogate pairs but still splits ZWJ sequences such as `👨‍👩‍👧` and accented letters written as base plus combining mark. This tool therefore cuts on the browser’s native grapheme boundaries — what you would call one character. Word order leaves your layout alone. Leading and trailing whitespace and the gaps between words all stay where they are; only the words move. Reversing everything would turn ` foo bar` into `bar foo `, with the indent stranded at the end.

Features

  • Four independent modes: within each line, whole text, line order and word order
  • Grapheme-aware, so emoji, skin-tone modifiers, ZWJ sequences and combining marks never split in half
  • Line-structure-preserving modes keep the number of lines unchanged
  • Word order keeps leading and trailing whitespace and the gaps between words
  • Line order is a pure reordering — nothing inside a line moves
  • Handles CRLF, CR and LF, and always writes LF back
  • Blank lines take part like any other (line order turns them around too)
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Paste the text you want to reverse
  2. Pick a unit to reverse by; the result updates as you type
  3. Click Copy to take the result

FAQ

What is the difference between “whole text” and “line order”?
Line order only moves lines around; nothing inside a line changes: `abc / def` becomes `def / abc`. Whole text treats the entire thing as one sequence including the line breaks: `abc\ndef` becomes `fed\ncba`. The line count is unchanged either way, but each line now holds content from what used to be a different line, and a trailing newline flips to a leading one. It is the literal “rotate the paper 180°” reading, which is exactly why it is its own option.
Why is my indentation still at the start after reversing word order?
Because what moves is the words, not the characters. The line is split into an alternating sequence of words and gaps; the gaps stay in their slots and only the words are reordered. So ` foo bar ` becomes ` bar foo ` with both the two leading spaces and the trailing spaces intact. Reversing the gaps as well would strand the indent at the end, which counts as quietly reformatting your text.
Will emoji get mangled?
No. The text is cut on the browser’s own grapheme boundaries (the grapheme granularity of `Intl.Segmenter`), which follow what a reader would call one character rather than code units or code points. A skin-tone emoji like `👍🏽`, a ZWJ family sequence, and a letter written as base plus combining mark all survive as single units.

Related tools