# Text Reverser

URL: https://hifreetools.com/text/reverse-text

> Reverse any text backward by characters, words, or lines. The character mode works on whole code points, so most emoji and other symbols above U+FFFF stay intact instead of breaking into garbled boxes.

## Quick answer

To reverse text, paste it into the box and choose a mode: by characters reads the whole string right to left, by words keeps each word readable but flips their order, and by lines flips the top-to-bottom order. Character mode uses Array.from so single-code-point emoji and surrogate-pair symbols are reversed without being split.

## Formula

- Reverse by characters: output = Array.from(input).reverse().join("")
- Reverse by words: output = input.trim().split(/\s+/).reverse().join(" ")
- Reverse by lines: output = input.split(/\r?\n/).reverse().join("\n")

The tool offers three independent reversal modes. In character mode the input is split into an array of Unicode code points with Array.from(input) rather than input.split("") — this keeps emoji and surrogate pairs (characters above U+FFFF) intact — and the array is reversed and re-joined, so the text reads exactly right to left. In word mode the string is split on whitespace (/\s+/), the resulting word array is reversed, and the words are re-joined with single spaces, so each word stays spelled correctly but the order is flipped. In line mode the input is split on newlines (/\r?\n/), the line array is reversed, and the lines are re-joined with newline characters, flipping the document top to bottom. All processing runs locally in your browser as you type; nothing is uploaded.

## Examples

- Reverse a word by characters: hello → olleh
- Reverse text containing an emoji: Hi 👋 → 👋 iH
- Reverse a sentence by words: the quick brown fox → fox brown quick the
- Reverse a list by lines: apple banana cherry → cherry banana apple
- Confirm a palindrome: racecar → racecar

## FAQ

**How do I reverse text online?**
Paste or type your text into the box above and choose a reversal mode — by characters, by words, or by lines. The reversed result appears instantly and you can copy it with one click. Everything runs in your browser, so nothing is sent to a server.

**What is the difference between reversing by characters, words, and lines?**
By characters reads the entire string right to left (hello → olleh). By words keeps each word spelled normally but flips their order (one two → two one). By lines keeps each line's text but flips their top-to-bottom order. Choose the one that matches what you want flipped.

**Does this tool reverse emoji correctly?**
Mostly. Character mode uses Array.from, which splits text by Unicode code points instead of UTF-16 units, so single-code-point emoji like 👋 stay whole. Flags and skin-tone or combined emoji are built from several code points, so their parts can swap or separate.

**Can I use a reversed string to check for a palindrome?**
Yes. Reverse your text in character mode and compare it to the original. If they match exactly, the text is a palindrome — for example, "racecar" reversed is still "racecar".

**Is my text uploaded anywhere?**
No. All reversing happens locally in your browser with plain JavaScript. Your text never leaves your device, which makes the tool safe for private notes, drafts, and sensitive content.

**Why does reversing by words add or change spacing?**
Word mode splits on any run of whitespace and re-joins the words with a single space, so irregular spacing, tabs, or double spaces between words are normalized to single spaces in the output.


## Sources

- [MDN: Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
- [MDN: Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse)
- [Unicode Surrogate Pairs](https://en.wikipedia.org/wiki/UTF-16)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Text Reverser", https://hifreetools.com/text/reverse-text
