All Tools
T

Reverse Text

Reverse text by character or by word instantly

Read the full guide for this tool

Reverse Text: Flip Characters or Words Instantly

Sometimes you need text backwards. Maybe you're solving a coding puzzle, debugging a string transformation, generating mirror text, or just messing around. This tool reverses text two ways — by character or by word — and gives you the result instantly.

Hello World reversed by character becomes dlroW olleH. Reversed by word becomes World Hello.

Simple tool. Does one thing. Runs in your browser.

What's actually happening

Character reversal uses Array.from() to split the string into an array of characters, then reverses the array and joins it back. The Array.from() is important — it handles Unicode correctly. The naive approach of string.split('') breaks multi-byte characters like emoji. Array.from('👋Hello') correctly treats 👋 as one element, while '👋Hello'.split('') splits the emoji into two surrogate halves and produces garbage.

Word reversal splits on whitespace boundaries using split(/(\s+)/), which captures the whitespace as separate array elements. This preserves your original spacing — if you had two spaces between words, you still have two spaces after reversal. The non-whitespace elements get reversed while the spacing stays in place.

Using it

Type or paste your text. Pick By Character or By Word. The output updates instantly. Hit Copy.

When you'd actually reach for this

Character reversal vs word reversal — when each matters

Character reversal flips everything. Punctuation moves. Spaces move. The string is a perfect mirror.

Word reversal keeps each word intact but flips their order. Punctuation stays attached to its word. "Hello, World!" becomes "World! Hello," — the comma stays on "Hello" and the exclamation stays on "World" because the tool doesn't know about punctuation semantics. It treats Hello, as a single token.

For name flipping ("Last First" → "First Last"), word reversal works. For generating mirror text or solving string puzzles, character reversal is what you want.

Edge cases

Emoji — character reversal handles single emoji correctly. But compound emoji (like 👨‍👩‍👧‍👦, which is four people joined by zero-width joiners) may break apart when reversed because Array.from() splits on code points, not grapheme clusters. For most single emoji, it works fine. For complex emoji sequences, the reversal might produce unexpected results.

RTL text — Arabic and Hebrew text that's already right-to-left will look visually different when character-reversed, but the logical order of characters is what actually changes. The visual rendering depends on your browser's bidirectional text algorithm.

Newlines — multi-line text reverses across lines in character mode. "line1\nline2" becomes "2enil\n1enil". The newline character reverses position too. In word mode, words are reversed but line breaks stay roughly in place since they're treated as whitespace.

Empty input — produces empty output. No errors, no edge case failures.

Troubleshooting

Reversed emoji looks broken — you're probably using a compound emoji (family, flag, skin-toned). These are multiple code points joined by special characters. Reversing them separates the components. Use simpler emoji or accept the limitation.

Word reversal didn't flip my comma — correct. The tool reverses word order, not punctuation. "one, two, three" becomes "three two, one,". Punctuation is attached to its adjacent word. Strip punctuation first if you need clean word reordering.

My reversed text has weird spacing — the tool preserves original whitespace. If your input had tabs, non-breaking spaces, or multiple consecutive spaces, the output will too. Normalize your whitespace before reversing if this matters.

The output looks the same as the input — you might have a palindrome. Or your text is a single character. Or it's empty. Check the input.

What to do with it

Copy the result and use it wherever you need it — code editors, puzzle solvers, test data, or social media. For programmatic reversal in your own code:

One thing worth noting: string reversal is a common interview question, and the Unicode gotchas (surrogate pairs, grapheme clusters) are exactly what interviewers are testing for. The naive .split('').reverse().join('') approach in JavaScript is wrong for any non-ASCII input. Array.from() fixes the surrogate pair issue but still doesn't handle grapheme clusters. For production-grade reversal, you'd need the Intl.Segmenter API.