“Reverse text” can mean three different things, and the right one depends on what you are doing: writing a word backwards for a puzzle, flipping the order of words in a sentence, or turning a list upside down. Here is how to do each — online, in Excel and in code — and the one pitfall that trips up even experienced programmers.
The three kinds of reversing
| Mode | Input | Output |
|---|---|---|
| Reverse characters | Hello world | dlrow olleH |
| Reverse words | one two three | three two one |
| Reverse lines | Monday / Tuesday / Wednesday (one per line) | Wednesday / Tuesday / Monday |
- Characters — for puzzles, games, backwards captions and checking palindromes.
- Words — for word games and re-ordering items written on one line.
- Lines — for flipping a log, a chat export or a ranked list so the last item comes first.
Online
Paste your text into the free Reverse Text tool, choose Reverse Characters, Reverse Words or Reverse Lines, and copy the result. It updates as you type and runs in your browser.
Two details to know: reversing characters also reverses the order of lines, and reversing words joins everything with single spaces, so use Reverse Lines when the line structure matters.
In Excel
In Microsoft 365, this formula reverses the characters in cell A1:
=TEXTJOIN("", TRUE, MID(A1, SEQUENCE(LEN(A1), 1, LEN(A1), -1), 1))SEQUENCE counts from the last position down to 1, MID picks one character at each position, and TEXTJOIN glues them back together.
To reverse the order of rows in a column, add a helper column numbered 1, 2, 3… and sort by it from largest to smallest, or use =SORTBY(A2:A20, ROW(A2:A20), -1).
In JavaScript
const reverseChars = (s) => [...s].reverse().join('');
const reverseWords = (s) => s.trim().split(/\s+/).reverse().join(' ');
const reverseLines = (s) => s.split('\n').reverse().join('\n');Note the [...s] rather than s.split(''). That difference is the pitfall described below.
In Python
text[::-1] # characters
' '.join(reversed(text.split())) # words
'\n'.join(reversed(text.splitlines())) # linesWhy emoji and some letters break
Computers store text as a sequence of code units, and not every visible character is one unit:
- Many emoji take two code units in JavaScript (a “surrogate pair”). Reversing with
split('')swaps the two halves and produces garbage. - Flags are two characters (🇮🇳 is the regional letters I and N). Reverse them and you get a different flag — 🇳🇮, Nicaragua.
- Accented letters can be a base letter plus a combining mark (e + ◌́). Reverse them and the accent jumps onto the wrong letter.
- Hindi and other Indic scripts combine consonants, vowel signs and the virama into one visible syllable; reversing code units breaks those syllables apart.
- Family and skin-tone emoji are several emoji joined by invisible joiners.
[...s] in JavaScript fixes the first problem but not the others. For truly correct reversal of what users see, split text into grapheme clusters with Intl.Segmenter:
const seg = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
const reverseVisible = (s) => [...seg.segment(s)].map((x) => x.segment).reverse().join('');The simple rule for everyday use: reverse characters for plain English text; reverse words or lines when the text contains emoji, flags or non-Latin scripts.
Palindromes
A palindrome reads the same backwards: “level”, “racecar”, “madam”, and numbers like 12321. For phrases, ignore spaces, punctuation and capital letters:
- “Never odd or even”
- “Was it a car or a cat I saw?”
- “A man, a plan, a canal: Panama”
To check one, remove spaces and punctuation, make it lower case with the Case Converter, then reverse it and compare. In code:
const isPalindrome = (s) => {
const t = s.toLowerCase().replace(/[^a-z0-9]/g, '');
return t === [...t].reverse().join('');
};Reversed text is not mirrored or upside-down text
- Reversed text uses normal letters in the opposite order: “olleH”.
- Upside-down text replaces letters with Unicode look-alikes that appear rotated: “ollǝH”. Use Upside Down Text for that.
- Mirror writing, like “AMBULANCE” on the front of an ambulance, flips each letter's shape. Plain text cannot do that; flip an image of the text with Flip Image.
Ideas for using reversed text
- Treasure-hunt and escape-room clues
- Classroom spelling and reading exercises
- Quick checks for string-handling code
- Reading a newest-first log in date order (reverse lines)
- A playful username or caption



