Illustration of an emoji split into fragments beside the same emoji kept whole after reversing

Text & writing

Why Reversing Text Can Break Emoji

Reversing a string sounds like the simplest possible text operation — just read it backwards. But many common ways of doing it break emoji, flags, and accented letters, producing boxes, question marks, or the wrong characters. This guide explains why, and how to reverse text safely.

Ready to try the tool this guide describes?

What “a character” means

Computers store text as code units, and one visible character can be several of them. In JavaScript, text is stored in UTF-16, where many emoji need two code units. A visible character can also be several Unicode code points: an emoji with a skin tone is a base emoji plus a modifier, a family emoji joins several emoji with zero-width joiners, and a flag is two regional-indicator letters.

How naive reversal goes wrong

Flags show the problem neatly: the United Kingdom flag is the regional-indicator letters G and B. Reversing the code points gives B then G — which is the flag of Bulgaria.

How naive reversal goes wrong comparison
MethodWhat it reversesWhat breaks
Reversing code unitsUTF-16 unitsEmoji outside the basic range turn into invalid characters.
Reversing code pointsUnicode code pointsSkin tones detach, joined emoji split apart, accents move to the wrong letter.
Reversing grapheme clustersUser-perceived charactersNothing — each visible character stays whole.

Reversing correctly

The safe approach is to split the text into grapheme clusters — the units Unicode defines for user-perceived characters — and reverse those. Browsers provide this through Intl.Segmenter with grapheme granularity, which is what the Looty Tools Reverse Text tool uses.

Testing a reverser

  • Reverse a skin-tone emoji such as 👍🏽 and check that the tone stays attached.
  • Reverse a family emoji and check that it stays one picture.
  • Reverse a flag and check that it is still the same country.
  • Reverse text twice and confirm you get the original back.

Why Reversing Text Breaks Emoji FAQ

Why do emoji turn into boxes when text is reversed?
The reverser split the emoji into code units or code points, producing invalid or separated characters.
What is a grapheme cluster?
Unicode’s term for a user-perceived character — what a reader sees as one character, even if it is made of several code points.
Why did my flag change country when reversed?
Flags are pairs of regional-indicator letters. Reversing the pair gives a different country code, such as GB becoming BG.
How do I reverse text safely in JavaScript?
Split it into grapheme clusters with Intl.Segmenter using grapheme granularity, reverse the array, and join it back together.
Does reversing twice always restore the original?
With grapheme-aware reversal, yes. Naive methods can permanently damage characters.

Related guides

Open the tool

Jump into Reverse Text when you are ready to process your files.

← Back to all guides

More from Looty

Explore Looty’s Ecosystem

Discover more ways Looty can help you learn, organize, create, and make an impact.