String Reverse Tool
Reverse text strings quickly with multiple reverse modes
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
- Enter or paste the text to reverse in the left input box
- Select a reverse mode (reverse all, reverse words, etc.)
- The right side automatically shows the reversed result
- 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
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 AReverse 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 xofPalindrome 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 intactReverse 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 startupFAQ
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.