Skip to main content
TextReverse

Reverse Words

Flip the order of the words in a sentence or paragraph while every word stays spelled exactly as you wrote it. "Hello World" becomes "World Hello" — readable, just rearranged.

The implementation preserves whitespace exactly, including double spaces, tabs and line breaks. That sounds like a detail until you paste a formatted list and get it back with the indentation intact.

Reverse the word order herehere order word the Reverse

Want each word spelled backwards instead? Reverse each word

Try an example
0 characters0 words0 lines
Output
Your transformed text will appear here...
0 characters0 words0 lines
Ctrl + Enter Copy resultEsc Clear

Word Order Examples

What word-order reversal does to real text, including the whitespace cases most tools get wrong.

InputOutputWhat it shows
Hello WorldWorld HelloThe canonical example: two words, swapped.
The quick brown fox jumpsjumps fox brown quick TheFive words reversed; every word still readable.
Hello, World!World! Hello,Punctuation stays attached to the word it touched.
one two threethree two oneDouble and triple spaces are preserved rather than collapsed.
a b cc b aTabs and newlines act as separators and travel with the reversal.
padded sentence sentence padded Leading and trailing whitespace is left exactly where it was.
To be or not to bebe to not or be ToA phrase that is nearly palindromic at the word level.
first line second lineline second line firstNewlines are whitespace, so line order flips as a side effect.

How Word Reversal Is Implemented

One regular expression does most of the work, and the choice of regex is what preserves your formatting.

Split with a capturing group

The text is split on /(\s+)/ — the parentheses make the separators part of the resulting array rather than discarding them. Reversing that array and joining it restores every gap character for character.

No trimming, no normalising

Nothing is trimmed and no run of whitespace is collapsed. A pasted list keeps its indentation, and a paragraph with a stray double space comes back with that double space in the mirrored position.

Punctuation belongs to its word

There is no attempt to detach commas or full stops from the tokens they touch. That keeps the behaviour predictable, which matters more than being clever about grammar.

Reversing twice restores the original

Because separators are preserved along with words, running the output back through the tool reproduces your input exactly. It is a useful way to confirm nothing was lost.

Words, Letters or Everything

The distinction between these rows is the most common source of "that is not what I wanted" on a reversal site.

Shared input: Reverse the word order

TransformationResultReach for it when
Reverse word orderorder word the ReverseYou want the last word first, every word readable.
Reverse each wordesreveR eht drow redroYou want each word spelled backwards in place.
Reverse everythingredro drow eht esreveRYou want one continuous end-to-start reversal.
Reverse linesReverse the word orderYour text is a list and only the line order should change.

Word Reversal Edge Cases

Four behaviours worth knowing about before you paste something formatted.

Line breaks reverse the line order too

A newline is whitespace, so reversing the words of a multi-line block also flips which line comes first. Use the reverse lines tool if line order is all you want to change.

Capitalisation does not follow the sentence

The originally capitalised word keeps its capital and ends up at the end. Run the result through sentence case if you need it to read as a proper sentence.

Hyphenated compounds stay together

"state-of-the-art" is one token because there is no whitespace inside it. Replace the hyphens with spaces first if you want its parts reversed individually.

Non-breaking spaces count as whitespace

Text copied from a web page often contains U+00A0 non-breaking spaces. They are matched by \s and treated as separators, which is usually what you want but can surprise you when the output spacing looks different.

Where Word Reversal Is Useful

The output is ordinary text with ordinary spacing, so it goes anywhere without special handling.

Spreadsheets

Reversing the word order of a name column produces a "surname first" variant for sorting. Paste a column, reverse, paste back — the row alignment is unaffected because line breaks are preserved.

Language teaching

Reversed sentences are a standard word-order exercise. Because every word stays spelled correctly, students focus on syntax rather than decoding.

Creative writing

Reversing a line is a quick generative constraint. Poets and lyricists use it to find phrasings they would not have reached by intention.

Social captions

A reversed caption reads as a small puzzle while remaining fully copyable, so anyone can paste it back here to unscramble it.

Reasons to Reverse Word Order

Readable scrambling

When you want text to be puzzling rather than unreadable, word reversal hits the right level — the vocabulary is intact and only the order is scrambled.

Building sorting variants

Word-order reversal is the quickest way to derive "last name, first name" from a plain name list without a formula.

Testing whitespace handling

Paste a string with tabs and double spaces to check whether your own reverse implementation normalises whitespace behind your back.

Classroom word games

Reversed sentences have exactly one correct reconstruction, which makes them easy to set and easy to mark.

Frequently Asked Questions

Related Text Tools

Browse all text tools →