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 keeps every whitespace character, including double spaces, tabs and line breaks, while reversing their order along with the words. It does not collapse gaps or trim the ends; formatted rows are not reversed independently.

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
Example: “Hello World” becomesWorld Hello
0 characters0 words0 lines
Ctrl + Enter Copy resultEsc Clear

Need a Different Kind of Reverse?

“Reverse” means different things to different people. Each tool below does one of them, shown on a real example.

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 swap ends without being trimmed.
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. Each gap moves with the reversal, including indentation and leading or trailing whitespace, so formatted rows may be regrouped.

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.

Words reverse across line breaks

A newline is whitespace, so the words reverse across the whole block rather than separately on each line. Lines with different word counts can be regrouped. Use reverse lines if you only want to change line order.

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

Reverse one name at a time to produce a "surname first" variant. Pasting a whole column also reverses the row order, and names with different word counts can be regrouped across lines. Do not paste that result over an aligned column.

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

For a single two-part name, word-order reversal gives "last name first name" without a formula. Process names one at a time to keep spreadsheet rows aligned, and add any comma yourself.

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 →