ToolActToolAct

String Reverse Tool

Reverse text strings quickly with multiple reverse modes

Input
Characters: 0
Lines: 0
Output
Characters: 0
Lines: 0

Select Reverse Mode

What is String Reverse?

String Reverse flips the order of text characters and produces the input in reverse order. The idea is simple, but real text can make it more interesting than reversing plain ASCII letters: Unicode characters, emoji, combining accents, line breaks, whitespace, and right-to-left scripts may behave differently depending on how characters are counted. The tool works for text experiments, palindrome checks, small puzzles, string debugging, teaching, and revealing hidden spaces or suffixes. It is not a cryptographic obfuscation method or a safe way to mask sensitive data. When the input contains emoji sequences or characters made from multiple code points, the reversed output should be inspected carefully.

How to Use

Basic Operations

  1. Enter or paste the text to reverse in the left input box
  2. Select a reverse mode (reverse all, reverse words, etc.)
  3. The right side automatically shows the reversed result
  4. Click 'Copy' to copy the result, or 'Swap' to use the result as input for further operations

Text Handling

  • Reversing plain text is simple, but emoji, combining marks, and right-to-left scripts can produce unexpected visual results.
  • For code, URLs, or structured data, reverse only the intended segment rather than the entire text blindly.

Use Cases

Reverse text at different structural levelsChoose full character reversal, word order reversal, each-word reversal, each-line reversal, line order reversal, or sentence order reversal. The output updates as input changes and can be swapped back into the input panel. Picking the right level keeps the result meaningful: reversing words shuffles the list, while reversing each word keeps each item intact and only flips its letters.
Test text transformations and edge casesThe character-level modes use spread syntax, which handles many Unicode characters better than simple byte reversal. Line and word modes preserve different parts of whitespace depending on the selected transform, making it useful for quick data experiments. Pasting tricky inputs like empty lines, double spaces, or trailing tabs reveals how each mode handles invisible separators.
Prepare playful or diagnostic text variantsReverse names, lists, sentences, or log lines for puzzles, test data, layout checks, and manual comparisons. Line counts and character counts on both panels help confirm whether the transformation changed structure or only ordering. The two counts should match between input and output for a pure reversal, which makes a quick numerical check a reliable smoke test.
Verify palindromes including emoji sequencesPaste a phrase and switch to character-level reversal to check whether it reads the same forward and backward. The spread-based approach keeps multi-codepoint emoji and combining accents as single units, so a reversed rainbow flag string still groups the flag correctly. A true palindrome should return to its original form after a single reverse-all pass, which is a quick check for input that looks symmetric but is not.
Reverse grapheme-aware emoji and RTL bidi textFor inputs like '👨‍👩‍👧' (a family emoji built from man, ZWJ, woman, ZWJ, girl), a naive byte-reversal splits the sequence into broken glyphs. This tool iterates by grapheme cluster, so a reversed family emoji stays intact instead of becoming '👧‍👩‍👨'. For Arabic or Hebrew input, the visual right-to-left order is preserved by the renderer; character-level reversal in the data will still look reversed on screen, so test the result with the language rendering before assuming a bug.

Technical Principle

Character-level reversal uses spread syntax: [...str].reverse().join(''). The spread operator iterates the string as a sequence of Unicode code points, which correctly handles characters outside the Basic Multilingual Plane that occupy two UTF-16 code units (surrogate pairs). The naive alternative, str.split('').reverse().join(''), splits on code units and breaks any emoji like the party popper 🎉 (U+1F389), the rocket 🚀 (U+1F680), or any character above U+FFFF. Grapheme clusters add another layer. A user-perceived character such as cafe with a combining acute accent (a + ◌́), a flag emoji built from two regional indicators, or a ZWJ-joined family emoji 👨‍👩‍👧 is several code points long. Code-point reversal still rearranges the pieces, so the family emoji becomes three separate human figures and the accent drifts off the base letter. Intl.Segmenter with granularity: 'grapheme' is the standards-compliant way to iterate grapheme clusters and keep these sequences intact during reversal. At the operation level the cost is O(n) in the number of segments, where n is the string length in code points or graphemes depending on the chosen segmentation. Reversing twice yields the original string, which is what makes the function useful for palindrome checks. For Unicode-heavy input, NFC normalization (str.normalize('NFC')) before reversal collapses base + combining sequences into precomposed forms when one exists, reducing surprises in the output. Right-to-left scripts like Arabic and Hebrew are stored in logical order but rendered right-to-left, so a reversed Arabic string still looks reversed even though the data order has flipped.

  • Code-point reversal: [...str].reverse().join('') iterates by code point and preserves surrogate pairs above U+FFFF (most emoji)
  • Naive byte trap: str.split('').reverse().join('') splits UTF-16 code units and corrupts any character above U+FFFF
  • Grapheme clusters: Intl.Segmenter({ granularity: 'grapheme' }) keeps combining marks, flag sequences, and ZWJ emoji 👨‍👩‍👧 intact
  • Word-level reversal: split(/\s+/), reverse, join(' '); preserves each word internally and only flips order
  • Complexity: O(n) where n is the number of segments; reversing twice returns the original string
  • NFC normalization: str.normalize('NFC') folds combining sequences into precomposed forms before reversal when one exists
  • Bidi text: Arabic and Hebrew are stored in logical order; the rendered direction is the browser's BiDi layer, separate from the data reversal

Examples

Reverse all characters (basic)

Mode: Reverse All
Input:  hello world
Output: dlrow olleh

Input:  12345
Output: 54321

Input:  A man a plan a canal Panama
Output: amanaP lanac a nalp a nam A

Reverse words vs reverse each word

Input: The quick brown fox

Mode: Reverse Words (word order only)
-> fox brown quick The

Mode: Reverse Each Word (letters inside each word)
-> ehT kciuq nworb xof

Palindrome check

Input:  racecar
Reverse All -> racecar    (same, is palindrome)

Input:  level
Reverse All -> level       (palindrome)

Input:  hello
Reverse All -> olleh       (NOT a palindrome)

Unicode and emoji safety

Input:  cafe (with combining acute on e)
Naive reverse: efac   (accent drifts off the letter)
Grapheme-aware: efac   (accent stays attached)

Input:  family-emoji-ZWJ-sequence
Naive reverse: broken into 3 separate emoji
This tool: keeps the cluster intact

Reverse line order in a log file

Mode: Reverse Line Order
Input:
  2026-06-10 09:00  startup
  2026-06-10 09:05  login ok
  2026-06-10 09:10  query slow

Output (newest first):
  2026-06-10 09:10  query slow
  2026-06-10 09:05  login ok
  2026-06-10 09:00  startup

FAQ

What does string reversal do?

Returns the input with characters in reverse order: 'hello' → 'olleh'. Useful for ROT-13 style toy ciphers, palindrome checking, generating mirrored display text, or quick demos of array manipulation in tutorials.

Will it reverse emoji and CJK correctly?

Most CJK characters and basic emoji work correctly because the page uses spread operator ([...text]) which handles UTF-16 surrogate pairs. Complex emoji sequences (family emoji, flag emoji, skin-tone combinations) may break during reversal since they consist of multiple code points that get separated.

What happens with combining accents?

Characters formed from a base letter plus combining marks (e + acute → é) reverse as a single grapheme. Decomposed-form input may need normalization first - the page may NFC-normalize on input to handle this. Visible result for natural language is correct either way.

How is reverse different from a mirror image?

Reversal is character-order: 'AB' → 'BA'. Mirror is visual flip: 'AB' shown as ⟨ƎA⟩, requiring CSS transform or special characters. The page reverses character order, not pixel mirror. For mirror-text effects, use CSS scaleX(-1).

Will it preserve line breaks?

By default, the entire input is reversed including newlines, so the last line ends up first. Toggle 'reverse each line individually' to reverse within lines while keeping line order, useful for visual effects on multi-line text.

Is reversed text always readable?

Languages that read left-to-right (English, Chinese, Japanese) become unreadable when reversed. Right-to-left languages (Arabic, Hebrew) can become awkwardly readable but are also broken because the bidi algorithm fights the reversal. Reversal is mostly a code or puzzle exercise, not a real text transformation.

Is my text uploaded?

No. Reversal runs in your browser. Pasted text is not transmitted.