Menu

Reverse Word Order

Paste your text and the words come out in reverse order, last word first, while the letters inside each word stay as they are. By default each line is reversed on its own.

0 words 0 characters 0 lines

Continue with this text: Reverse textShuffle linesSort lines

Your text stays in your browser: nothing is uploaded or stored on a server.

How to use it

  1. Type or paste your text into Your text, click Example to load a sample, or use Open file for a plain-text file (.txt, .csv, .md and similar).
  2. Leave Keep the order of lines (reverse words within each line) ticked to reverse each line on its own, or untick it to reverse the whole text as one sequence.
  3. The Result box updates as you type.
  4. Click Copy, Download .txt, or Use as input to keep working on the result. The links under the tool carry the text to Reverse text, Shuffle lines or Sort lines.

The tool remembers whether the option was ticked the next time you open it in the same browser.

The one option: keep the order of lines

The only setting decides what a line break means. With the sample text loaded:

one two three four
the quick brown fox
Keep the order of lines Result
Ticked (default) four three two one / fox brown quick the
Unticked fox brown quick the / four three two one

Ticked, each line is treated as a separate sentence: its words are reversed, but line 1 stays line 1. Empty lines are kept where they were. Use this for lists, one sentence per line, or song lyrics.

Unticked, the whole text is one long sequence of words and line breaks are treated like spaces that keep their position. Words can move from one line to another:

Before After (unticked)
First line here / Second line line Second / here line First

Here the line break still sits after the second word, but the words around it have changed. Use this mode when you want the very last word of the text to come first.

What counts as a word

The tool splits the text at whitespace (spaces, tabs, non-breaking spaces and, in the unticked mode, line breaks) and reverses the pieces. It does not look at grammar or punctuation, which gives these rules:

Before After Why
Hello, world! world! Hello, Punctuation belongs to the word it touches.
I love New York. York. New love I Names are not kept together; New York is two words.
Don't stop believing believing stop Don't Contractions are one word.
well-known fact fact well-known Hyphenated words have no space, so they stay whole.
café 👋🏽 naïve naïve 👋🏽 café Accents and emoji move with their word, unchanged.
東京 に 行く 行く に 東京 Spaced words in any script are reversed.
東京に行く 東京に行く No spaces, so the line is one word and stays as it is.

Capital letters are not adjusted: the first word of the original keeps its capital and ends up last (The quick brown fox → fox brown quick The).

Spacing is kept exactly. The gaps between words are reversed too, so double spaces and tabs survive, and spaces at the start or end of a line stay at the start or end. a␣␣b⇥c becomes c⇥b␣␣a. If you do not want odd spacing in the result, run Remove extra spaces first.

Line endings. In both modes, Windows line breaks (CR LF) come out as plain LF line breaks. Whitespace at the very start and end of the text stays where it is, so a text that ends with a line break still ends with one (one two plus a final line break becomes two one plus a final line break), even with the option unticked.

Reverse word order vs reverse text

These are different operations, and searches for “reverse words” often mean either one:

Tool The quick brown fox becomes
Reverse word order (this page) fox brown quick The
Reverse text, letters in each word ehT kciuq nworb xof
Reverse text, the whole text xof nworb kciuq ehT

Reversing the whole text is the same as reversing the word order and then spelling every word backwards. To reverse the order of whole lines instead of words, use Sort lines with “Reverse current order” (untick “Remove empty lines” if you want to keep blank lines).

When people need it

  • Turning names around. A list of Ada Lovelace lines becomes Lovelace Ada. Note that Smith, John becomes John Smith,, so remove the comma afterwards with Replace text.
  • Reading a path or breadcrumb from the other end. Home > Shop > Shoes becomes Shoes > Shop > Home, because the > separators are words too.
  • Language and memory exercises. Teachers scramble a sentence by reversing it and ask students to rebuild it; a reversed line of a poem or speech is a common recall drill.
  • Word games and puzzles. Reversed phrases make simple riddles and party games, and they show which sentences still make sense backwards.
  • Checking test data. Developers paste expected output to compare with a function that reverses words in a string.

Reversing words in a string in code

Programming tests often ask you to “reverse the words in a string”. These one-liners give the same result as this tool for single-spaced text; we ran each one on the quick brown fox and got fox brown quick the.

JavaScript:

s.split(' ').reverse().join(' ')

Python:

' '.join(s.split()[::-1])

They differ on extra spaces. The JavaScript version keeps empty pieces, so a␣␣b becomes b␣␣a, which matches this tool. Python’s split() with no argument drops all extra whitespace, so ␣a␣␣b␣ becomes b a. The JavaScript version splits only at single spaces, though, so tabs and line breaks stay inside a “word”. This tool splits at any whitespace and keeps every gap, so it also handles tabs and, with the option unticked, line breaks.

Questions

Does reversing the words also reverse the letters?

No. "the quick brown fox" becomes "fox brown quick the"; every word is spelled the same. To spell words backwards, use Reverse text with "Letters in each word" or "The whole text".

How do I reverse the words in a sentence?

Paste the sentence into the box. The result appears as you type, with the last word first. Copy it or download it as a .txt file.

What happens to commas and periods?

They stay attached to the word they touch, so "Hello, world!" becomes "world! Hello,". If you want a clean sentence, fix the punctuation and capitals by hand afterwards, or strip it first with Remove punctuation.

Can I reverse several sentences or a whole list at once?

Yes. With "Keep the order of lines" ticked (the default), each line is reversed separately and the lines stay in place. Untick it to reverse every word in the whole text, so the last word of the last line comes first.

Is this a reverse words translator?

It does not translate. It only changes the order of the words you enter. For backwards spelling, mirror-style or flipped text, try Reverse text or Upside-down text.

Does it work with emoji and other languages?

Yes, for languages that put spaces between words. Emoji and accented letters move as part of their word and are never split. Chinese or Japanese text without spaces is one "word" to the tool, so it comes back unchanged.

Is my text uploaded anywhere?

No. The words are reversed by JavaScript in your browser, and nothing is sent to a server.