Reverse String
Reverse text by character, word order, letters in each word or line order. Emoji, flags and accented letters stay whole instead of breaking apart. How it works
Use the Reverse String
Example: stressed becomes desserts
13 characters, 2 words and 1 line reversed.
A character here is what you see as one: an emoji, a flag or a letter with its accent moves as one piece.
About the Reverse String
Reversed by character, “Hello, World!” becomes “!dlroW ,olleH”. To reverse text by word order, by the letters inside each word or by line order, pick that mode instead. An emoji, a flag or a letter with its accent always moves as one character, so none of them breaks.
One input, four modes
| Reverse | “one two three / four five” | “Hello, World!” |
|---|---|---|
| Every character | evif ruof / eerht owt eno | !dlroW ,olleH |
| Word order | three two one / five four | World! Hello, |
| Letters in each word | eno owt eerht / ruof evif | ,olleH !dlroW |
| Line order | four five / one two three | Hello, World! |
A “/” stands for the line break between the two lines of the first input. A one-line text is unchanged by Line order.
Text that reversing by code point breaks
| Text | Reversed here | Reversed by code point |
|---|---|---|
| café (e + combining U+0301) | éfac | U+0301 first, on no letter, then efac |
| 🇸🇪 (flag of Sweden) | 🇸🇪 (flag of Sweden) | 🇪🇸 (flag of Spain) |
| 🇨🇦 (flag of Canada) | 🇨🇦 (flag of Canada) | 🇦🇨 (flag of Ascension Island) |
| 👍🏽 (thumbs up, medium skin tone) | 👍🏽 | 🏽👍 (skin tone split off) |
| a👨👩👧b (family: man, woman, girl) | b👨👩👧a | b👧👩👨a (not an emoji in the Unicode list) |
“By code point” is the common JavaScript one-liner Array.from(text).reverse().join(""). A flag is a pair of regional indicator letters, so swapping the pair can name another country.
Frequently asked questions
- How do I reverse the order of words in a sentence?
- Choose Word order. “one two three” becomes “three two one”, and each line is reversed on its own. Spaces stay where they were, leading spaces included (“ a b” becomes “ b a”), and punctuation moves with its word, so “Hello, World!” becomes “World! Hello,”.
- How do I reverse a string in JavaScript without breaking emoji?
- str.split("").reverse().join("") reverses UTF-16 code units and cuts most emoji into broken halves. [...str].reverse().join("") keeps code points whole but still splits what you see as one character: the flag of Sweden 🇸🇪 turns into the flag of Spain 🇪🇸. Split the text with Intl.Segmenter at grapheme granularity and reverse the segments, which is what this tool does. MDN lists Intl.Segmenter as working across current browsers since April 2024.
- How do I reverse a list so the last line comes first?
- Choose Line order. “first” and “second” on two lines come back as “second” and “first”, each line spelled as before. Windows line breaks (CR LF) come back as plain line feeds.
- Is there a limit on how much text I can reverse?
- The first 30,000 UTF-16 code units are reversed, and the page warns that the rest is left out. A plain letter is one unit and most emoji are two, so of a text of 20,000 smiley emoji (40,000 units) the first 15,000 are reversed.
- Is a reversed sentence a palindrome?
- Only when it reads the same both ways exactly as typed. Reversed by character, “A man, a plan, a canal: Panama” becomes “amanaP :lanac a ,nalp a ,nam A”. The letters match only once case, spaces and punctuation are ignored, which the Palindrome Checker does and this tool does not.
- What is a word that spells another word backwards called?
- A semordnilap, such as stressed and desserts or diaper and repaid. Wiktionary notes that the term is itself palindromes spelled backwards.
Related Tools
View all toolsWord Counter
Paste or type text to count words, characters with and without spaces, sentences, paragraphs and lines, plus reading time at 200 wpm and speaking time at 130.
Case Converter
Convert text to UPPER CASE, lower case, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE in one click.
Remove Duplicate Lines
Remove duplicate lines, or comma, tab or space separated items, keeping the first or last copy, with case, trimming, blank-line and sort options.
Text Replacement
Find and replace text in a pasted block, as plain text or regex, with a case option. Replace All gives the result and the number of replacements made.
Lorem Ipsum Generator
Generate lorem ipsum placeholder text as paragraphs, sentences or words, up to 100 paragraphs or 5,000 words, with optional HTML paragraph tags.
Random Text Generator
Generate 1 to 100 sentences or paragraphs picked from a fixed list of 20 well-known sayings. Useful as filler text and writing prompts.