About the Reverse String
Reversing a string is the classic interview exercise and the classic place where naive code breaks. Splitting on JavaScript characters tears a surrogate pair in half, so an emoji comes back as two broken code units, and it separates a letter from its combining accent. This tool segments the text into user-perceived characters first, using the browser Unicode segmenter where it exists, so a family emoji, a flag or a Devanagari cluster moves as one piece.
Five modes cover the usual reasons for reversing. Reversing characters across the whole text flips everything including the newlines. Reversing characters within each line keeps the lines in place, which is what you want for a column of codes. Word order can be flipped globally or line by line, and line order alone reverses the file without touching the content, handy for reading a log newest first.
Word mode splits on runs of whitespace and puts the original spacing back between the reordered words, so double spaces and tabs are preserved rather than collapsed. The status line counts the characters that were reversed. If you want vertically mirrored glyphs rather than a reversed order, that is a font trick rather than a string operation, and to check whether a phrase reads the same both ways use the Palindrome Checker.
How to use
- Paste or type the text.
- Pick a Reverse mode: characters, word order or line order.
- Copy the reversed result.
Common questions
- Do emoji survive the reversal?
- Yes. Multi-code-point sequences such as flags and family emoji are treated as one unit and stay intact.
- How do I reverse each line separately?
- Choose "Characters, each line". The lines stay in their original order and only their contents are flipped.
- Is spacing preserved when reversing words?
- Yes. The whitespace runs between words are kept, so tabs and double spaces come back unchanged.
- What about right-to-left text?
- The underlying characters are reversed in storage order. Because the browser applies its own bidirectional display rules, Arabic and Hebrew may still render in an order that surprises you.