Text & writing

How to Reverse Text Backwards, by Word or by Line

How to write text backwards, flip the order of words in a sentence, or reverse a list of lines - what each mode keeps and changes, why emoji and accents need care, and worked examples with palindromes.

5 min readUpdated

"Reverse this text" can mean three different things. You might want the letters backwards, so "hello" reads "olleh". You might want the words in the opposite order, so "the quick brown fox" becomes "fox brown quick the". Or you might have a list - a log file, a ranking, a set of dated notes - that you want turned upside down so the last line comes first. The Text Reverser does all three, one mode at a time, and this guide explains exactly what each mode does to your text so the result is the one you expected. Everything runs in your browser; nothing you paste is uploaded.

The three modes at a glance

  • Characters - every line is written backwards, letter by letter. "Hello, world!" becomes "!dlrow ,olleH".
  • Words - the words in each line swap order, but each word is still spelt forwards. "Hello, world!" becomes "world! Hello,".
  • Lines - the lines swap order and each line is left exactly as it was. A list of first, second, third becomes third, second, first.

Pick the mode with the switch above the text box, then type or paste. The output updates as you type, and the Copy button under it puts the result on your clipboard.

Reversing characters: writing text backwards

Character mode is the one most people mean by "reverse text". It is used for mirror-writing puzzles, checking palindromes, quick obfuscation of a spoiler, and novelty usernames. Each line is reversed on its own, so a three-line poem stays three lines - only the content of each line is flipped. Punctuation and spaces are characters too, so they move with everything else: the comma that sat after "Hello" ends up before it.

The part that trips up simpler tools is what counts as a character. On screen, a flag, an emoji family or an accented letter looks like one symbol, but it is stored as several code points glued together. A tool that reverses code points splits that glue apart. The flag of India, for example, is stored as two regional-indicator letters, I then N; reverse them and you get N then I, which is the flag of Nicaragua. A decomposed "é" is a plain e followed by a combining accent; reverse the code points and the accent ends up floating at the front of the word, attached to nothing. A family emoji falls apart into separate people.

This tool reverses by grapheme cluster - the unit your eye reads as one character - using the browser's own Unicode segmentation. So "India" followed by the Indian flag comes out as the Indian flag followed by "aidnI", accents stay on their letters, and emoji survive intact. That matters if the output is going into a username, a social post or a puzzle where a broken symbol is obvious.

Worked example: checking palindromes

A palindrome reads the same backwards. Paste "racecar" in character mode and the output is "racecar" - identical, so it passes. Now try the famous sentence "Was it a car or a cat I saw". The output is "was I tac a ro rac a ti saW". It is not character-for-character identical, because the capital letters and the spaces land in different places, but if you ignore case and spacing the letters match: wasitacaroracatisaw both ways. "Never odd or even" behaves the same way, coming back as "neve ro ddo reveN". So for sentence palindromes, compare the letters only; for single words, an exact match is enough.

Reversing word order

Word mode keeps each word readable and flips their order within the line. It is useful for turning "Surname, First name" style data around, for language exercises, and for reversing a breadcrumb such as "Home > Shop > Shoes" into "Shoes > Shop > Home".

Two details are worth knowing before you rely on it. First, a word is anything between spaces, so punctuation stays stuck to the word it touched: "Hello, world!" becomes "world! Hello," rather than "world, Hello!". If you want tidy punctuation, fix it by hand afterwards. Second, the gaps between words are kept exactly as they were and simply reversed along with the words. A line that starts with two spaces of indentation ends with them instead, and a double space between two words stays a double space. If that leaves stray whitespace, run the output through the Whitespace Remover.

Reversing line order

Line mode turns a list upside down and leaves every line untouched. Paste a log with the oldest entry first and you get the newest first; paste a top-ten list and you get a countdown. It is not a sort - the lines are not compared or alphabetised, only reversed - so if you want them in A-to-Z or numeric order, use Sort Lines instead, which orders lines alphabetically, by number or by length, in either direction.

One quirk: if your pasted text ends with a line break, that final empty line is a line too, and it moves to the top. "a", "b" and a trailing newline come out as a blank line followed by "b" and "a". Delete the trailing line break before reversing, or the blank first line after, if it matters where you are pasting.

Step by step

  1. Open the Text Reverser and choose Characters, Words or Lines.
  2. Paste your text into the box. The reversed version appears below immediately.
  3. Check the output for the details covered above: punctuation in word mode, a blank first line in line mode.
  4. Switch modes freely - your input stays put, so you can compare all three results.
  5. Press Copy and paste the result wherever you need it.

Can you combine modes?

Yes, by running the tool twice. Reversing characters across a whole block and then reversing lines gives you a complete mirror of the text - the last character of the last line becomes the first character of the first line. Copy the first output back into the box and switch modes to do it. Reversing twice in the same mode always gets you back to where you started, which is a handy way to check that nothing was lost.

Frequently asked questions

How do I write text backwards?
Paste it into a text reverser in Characters mode. Each line is flipped letter by letter, so "hello world" becomes "dlrow olleh", and line breaks stay where they were. Spaces and punctuation are reversed along with the letters.
Why does reversed text sometimes break emoji and flags?
Because many symbols are stored as several code points. A flag is two regional-indicator letters and an emoji family is several emoji joined together, so reversing the raw code points pulls them apart - the Indian flag even turns into Nicaragua's. Reversing by grapheme cluster, which treats each visible character as one unit, keeps them intact.
What is the difference between reversing lines and sorting them in reverse?
Reversing lines just turns the list upside down without looking at the content, so the last line becomes the first. Sorting in reverse orders the lines from Z to A (or highest to lowest) by comparing them. A list that is already in alphabetical order gives the same result either way; any other list does not.