String Reverser

Reverse the character order of any text, useful for quick palindrome checks, puzzle generation, or sanity-checking string manipulation code. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-18

Overview

Introduction

Reversing a string sounds trivial until you try it in a language that iterates by UTF-16 code unit instead of by character. Emoji and other characters outside the Basic Multilingual Plane get corrupted. This tool reverses correctly by Unicode code point.

That distinction matters in practice whenever a string has characters outside the Basic Multilingual Plane, most visibly emoji, which JavaScript represents internally as a pair of UTF-16 code units called a surrogate pair. A naive reversal operating on those raw code units splits the pair apart, and each half renders as a broken replacement glyph instead of the original character. Iterating by code point keeps each character whole.

What Is String Reverser?

A string reversal takes the sequence of characters in the input and outputs them in the opposite order, last character to first.

It's a simple transformation with a genuinely tricky edge case hiding inside it. `str.split('').reverse().join('')`, the version most people write first, operates on UTF-16 code units rather than characters, which is exactly the naive approach that corrupts surrogate pairs. This tool's version is the corrected form of that same idea. Even code-point correctness has its own limits though, covered in the FAQ, for emoji built from multiple joined code points and for separately-stored combining accent marks.

How String Reverser Works

The tool spreads the input string into an array of Unicode code points, using JavaScript's iterator protocol, which respects surrogate pairs, reverses that array, and joins it back into a string.

Spreading a string with `[...input]` delegates to the string's default Symbol.iterator, which JavaScript defines to yield whole code points, not raw 16-bit units. It's a one-line difference from the naive split-based approach, but it's the entire reason this tool handles emoji and other supplementary-plane characters correctly where a quick regex or split wouldn't. To be precise about what this does and doesn't fix: it operates at the code-point level, one step above raw UTF-16 units, but below the level of an extended grapheme cluster, the user-perceived "character" that Unicode Text Segmentation (UAX #29) defines. Multi-codepoint sequences like ZWJ-joined emoji or flag pairs still get reversed internally even though each individual code point survives intact.

When To Use String Reverser

Use it to quickly check whether text is a palindrome, generate a 'backwards text' novelty string, or verify that your own reversal implementation handles emoji and other multi-byte characters correctly.

It's also a handy sanity check when you're writing your own reversal logic, whether for a coding exercise or production code. Run your implementation and this tool against the same emoji-containing input and compare the output. Differ, and your version is likely iterating by code unit instead of code point.

Often used alongside ROT13 Encoder/Decoder.

Features

Advantages

  • Correctly handles emoji and other characters made of surrogate pairs, unlike a naive character-by-character reversal.
  • Instant, client-side transformation with no size limits beyond browser memory.
  • Simple building block for palindrome checks and text puzzles.

Limitations

  • Reverses individual characters, not words, so word order and spelling within each word aren't preserved as readable text.
  • Multi-codepoint emoji sequences joined with zero-width joiners, like family or profession emoji, don't survive reversal as a single glyph even though no individual code point gets corrupted.
  • Flag emoji, built from a pair of regional indicator code points, can flip into a different or nonsensical flag when reversed.
  • Decomposed (NFD) combining accent marks can end up visually detached from the base letter they modify, since reversal treats the base letter and its combining mark as separate, independently-reordered code points.

Character Reversal vs. Word-Order Reversal

Character Reversal vs. Word-Order Reversal
Character reverse (this tool)Word-order reverse
Example: "Hello world" becomes"dlrow olleH""world Hello"
Preserves the spelling of each wordNoYes
Typical usePalindrome checks, novelty textRearranging phrase or sentence structure

Examples

Reversing a short phrase

Input

Hello, world!

Output

!dlrow ,olleH

Every character, punctuation included, gets reversed in place.

Simple emoji reverses correctly

Input

Hello ๐Ÿ‘‹ world

Output

dlrow ๐Ÿ‘‹ olleH

The wave emoji is stored as a surrogate pair, but code-point-aware iteration keeps the pair together, so it comes through reversal intact.

Multi-person emoji breaks apart

Input

abc๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆxyz

Output

zyx๐Ÿ‘ฆโ€๐Ÿ‘งโ€๐Ÿ‘ฉโ€๐Ÿ‘จcba

The family emoji is really four person emoji joined by invisible zero-width joiner characters. Reversing by code point reverses the whole sequence, joiners included, so it no longer renders as one family glyph.

Flag emoji order flips

Input

US๐Ÿ‡บ๐Ÿ‡ธflag

Output

galf๐Ÿ‡ธ๐Ÿ‡บSU

A flag emoji is a pair of regional indicator code points combined by a renderer. Reversing swaps their order, which usually displays as a different, often meaningless, flag.

A decomposed combining accent detaches from its letter

Input

eฬ test

Output

tset ฬe

This input stores the accented e as two code points, a plain "e" followed by a separate combining acute accent (U+0301). Reversing by code point moves the accent mark to just before the final "e" instead of after it, so the string no longer visually ends in "รฉ".

Best Practices & Notes

Best Practices

  • Use a code-point-aware reversal (like this tool) rather than a naive .split('') when text might contain emoji.
  • Combine with a case-insensitive comparison when using reversal to check palindromes that include mixed case.
  • Strip punctuation and spaces first if you want a 'meaningful words only' palindrome check.
  • Preview emoji-heavy text after reversing it before shipping the result anywhere. Code-point correctness doesn't guarantee ZWJ sequences or flag pairs render as expected.
  • Need reversal that's correct for every user-perceived character, multi-part emoji included? Use a grapheme-cluster-aware approach (Intl.Segmenter) instead of code-point iteration.

Developer Notes

This uses the spread operator on the string ([...input]), which delegates to the string's default iterator and yields whole code points rather than raw UTF-16 code units. That's the key difference from `input.split('').reverse().join('')`, and it's enough to fix the most common failure mode, corrupted surrogate pairs from emoji and other supplementary-plane characters. It's not, however, grapheme-cluster-aware. Unicode Text Segmentation (UAX #29) defines an extended grapheme cluster as the unit a user actually perceives as one character, and that can span multiple code points: a ZWJ-joined emoji sequence, a flag's regional-indicator pair, or a base letter plus a combining mark are each one grapheme cluster but several code points. Reversing at the code-point level, as this tool does, reorders the code points within those clusters along with everything else, which is why family emoji, flags, and decomposed accented letters are the three edge cases where output can look broken even though the underlying transformation ran correctly. A fully grapheme-cluster-correct reversal would need to detect cluster boundaries with Intl.Segmenter and reverse whole clusters as units, and this tool intentionally skips that to stay a simple, dependency-free operation.

String Reverser Use Cases

  • Checking whether a word or phrase is a palindrome
  • Generating novelty 'mirror text' for puzzles or games
  • Verifying a custom string-reversal implementation against a known-correct reference
  • Testing where code-point-level reversal still breaks down, family emoji, flag emoji, and decomposed accents being the main cases, before deciding whether you need grapheme-cluster-aware handling instead

Common Mistakes

  • Reversing with a naive character split that breaks emoji and other surrogate-pair characters into corrupted halves.
  • Expecting word order to reverse, when this flips individual characters, not the sequence of words.
  • Assuming code-point-aware reversal (like this tool's) is fully emoji-safe. Multi-codepoint sequences joined by ZWJ, like family emoji, and flag emoji pairs can still visually break even though no individual code point is corrupted.

Tips

  • To check a palindrome, lowercase and strip non-alphanumeric characters before reversing and comparing.
  • Need word-order reversal instead? Look for a dedicated 'reverse words' tool.
  • For guaranteed grapheme-cluster-correct reversal, one that handles ZWJ emoji sequences and flags as single units, you'd need Intl.Segmenter. This tool trades that edge-case coverage for simplicity.

References

Frequently Asked Questions