Reverse List / Line Order
Flip the order of lines so the last becomes the first.
Lines: 0Characters: 0
Reversing line order
This flips a list end-to-end — the last line becomes the first — while leaving each line's text untouched. It's the quick way to turn a chronological log into newest-first, undo an unwanted sort, or reorder a stack. (To reverse the characters within a line, use a text reverser instead; to reverse word order, use the word reverser.) Everything is computed locally in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Flipping a log so the newest entries appear first.
- Reversing a chronological list for display.
- Turning an ascending list into a descending one without re-sorting.
- Reversing a list before taking the first few items.
- Checking whether a list was built in the order you expected.
Frequently Asked Questions
- How is reversing different from sorting descending?
- Reversing preserves whatever order the list was already in, just backwards; sorting descending imposes a new order. On an unsorted list the two give completely different results, which is the usual source of confusion.
- Does a trailing newline create a blank first line?
- Yes — a file ending with a newline has an empty final element, which becomes the FIRST line after reversal. That stray blank line at the top is the commonest surprise here, and it is the data, not a bug.
- Are duplicates or blanks removed?
- No. Reversing only reorders — it never filters. If you want a clean reversed list, deduplicate and strip empty lines first, since doing it afterwards can change which duplicate survives.
- Does it work with CRLF line endings?
- Only if endings are normalised first. Splitting on \n alone leaves a trailing \r on every line, which then sits at the end of each reversed line and shows up as invisible corruption or ^M.
- What is this used for?
- Reading chronological logs newest-first, reversing a stack or history, undoing an accidental sort, and preparing data for tools that expect the opposite order. It is also the quickest way to see the end of a long list.
- Does reversing preserve the pairing between lines?
- Only within one list. Reversing two parallel lists separately keeps them aligned; reversing one and not the other silently mismatches every row — the classic error when two columns are handled as separate files.
- How does this differ from reversing a sorted list?
- Reversing a list sorted ascending gives descending order only if the sort was stable and total. With ties, reversal also flips the order within each tie group, which a descending sort would not do.
Common errors and gotchas
- Reversing a file whose first line was a header, which ends up last.
- Assuming reversal is the same as sorting descending, which it is not unless the input was sorted.
- Reversing lines when the words within them also needed reversing, or the reverse.
- Losing a trailing blank line's position, which some parsers care about.
- Reversing a list whose order was a sequence of dependent steps.
Related Text Tools tools
Case Converter
Convert between Sentence, Title, camelCase, snake_case, and more.
Word Counter
Count words, characters, and analyze keyword density.
Text to Binary
Convert text into its 8-bit binary representation.
Binary to Text
Decode 8-bit binary back into readable text.
Text Reverser
Reverse text by characters, words, or lines.
Remove Duplicate Lines
Delete repeated lines and keep your list unique.
Remove Empty Lines
Strip blank and whitespace-only lines from text.
Sort Lines Alphabetically
Sort lines A–Z or Z–A, case-sensitive or not.