Reverse Lines

Reverse the order of lines.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste text and press Run to flip its line order. The last line moves to the top and the first line to the bottom. The characters inside each line are not changed.

How to use

1
Step 1
Paste your lines into Input.
2
Step 2
Press Run.
3
Step 3
Copy the reversed order.

How it works

The text is split at every line break, the list of lines is reversed, and the lines are joined again. Blank lines move with the rest, so a trailing empty line becomes a leading one.

Worked example

A three-line list

Input
one two three
Output
three two one
Walkthrough
The same three lines appear in the opposite order.

Limitations

  • Does not reverse the letters inside a line; use Reverse Text for that.
  • A final newline at the end of the input becomes a blank first line.

Questions

How do I reverse the order of lines?
Paste them and press Run.
Can it reverse the letters in each line?
No. Use Reverse Text, which reverses characters.
Where does a trailing blank line go?
To the top of the output.

Features

  • Flips line order
  • Content of lines unchanged
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • CSS Flexbox Crash Course

    freeCodeCamp.org

    Case and spacing tools show up constantly in front-end copy.

    Watch on YouTube
  • HTML in 100 Seconds

    Fireship

    Quick HTML mental model next to text transform tools.

    Watch on YouTube