Sort Lines
Paste a list, one item per line, and reorder it — or shuffle it and get the same shuffle back.
What this tool does
Sort Lines reorders a pasted list six ways. Alphabetical compares whole lines. Natural reads runs of digits as numbers, so file2 lands before file10 rather than after it. Numeric value reads the number at the start of each line, accepting a sign, decimals and scientific notation. Line length puts short lines first. Reverse flips the order the lines arrived in without sorting them at all, and Shuffle rearranges them at random. The Direction control turns the first four round; it has nothing to reverse for Reverse and Shuffle, so it disappears for those two.
Three checkboxes decide what reaches the sort. Trim each line and Drop blank lines are both on to begin with, which is usually right for a list pasted out of a spreadsheet or an editor. Trim is worth understanding properly: it strips leading and trailing whitespace from the lines themselves, so indentation is gone from the output rather than merely ignored during comparison. Switch it off to keep indentation, and those leading spaces then take part in the sort. Remove duplicates is off by default; turned on it keeps the first copy of each line and matches ignoring case unless Case sensitive is ticked. Case sensitive is the one control with a rough edge. It governs that duplicate match as well as the sort, but the checkbox is only shown beside Alphabetical and Natural — pick Numeric value, Line length, Reverse or Shuffle and it disappears, leaving the duplicate match case-insensitive with nothing on screen to change it.
Two limits are worth knowing before you trust the result. The alphabetical order compares character codes rather than applying a language's collation rules, so every unaccented ASCII letter sorts ahead of é, ö and ß, and alphabets outside Latin come out in code order rather than their own dictionary order. Numeric order only reads the number at the beginning of a line — a figure in the middle is invisible to it — and commas are stripped as thousands separators, so 1,5 is read as fifteen. There is no column key either: the sort key is the whole line, which means a CSV is ordered by whatever its leftmost characters happen to be and a header row is sorted in with the data like any other line.
None of this reaches a server. Your list is sorted by JavaScript on your own machine and is not sent anywhere, which is why the tool keeps working once the page has loaded and the network is disconnected. It is a paste-and-copy workspace rather than a file one — there is no file picker and no download button — so the practical ceiling is what your browser will hold in a textarea and sort in memory, and the result comes back through Copy output.
How to use it
- Paste your list, one item per line. Load sample fills the box with a deliberately awkward mix — file10, file2, Banana, apple and a repeat — so you can watch each order behave before using your own list.
- Choose the order. Alphabetical, Natural, Numeric value, Line length, Reverse the current order or Shuffle. Direction switches ascending to descending for the first four.
- Seed a shuffle you need to repeat. Choosing Shuffle reveals a Shuffle seed field. Type anything into it and that exact ordering comes back on every run; leave it empty for a fresh shuffle each time.
- Decide what to clean up. Trim each line and Drop blank lines start on, Remove duplicates starts off, and Case sensitive — which the duplicate match reads as well — is only offered beside the alphabetical and natural orders.
- Run the sort and take the output. The note under the output gives the number of lines returned, and how many went when Remove duplicates dropped any.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Alphabetise a list before a review
Dependencies, domains, feature flags or names in an order someone can scan, so a missing entry reads as a gap instead of hiding in the middle of the list.
Ordering file names that carry numbers
Natural puts img2 before img10, which is what you meant and what a plain alphabetical pass over the same list will not give you.
Tidying a list pasted from a spreadsheet
Trailing spaces and empty rows travel with the paste. Trim and Drop blank lines clear both, and Remove duplicates collapses the repeats in the same run.
Drawing a random order
Shuffle lines to randomise a review rota, a running order or a test set, and set a seed when you may have to reproduce the same draw later.
Preparing two lists for comparison
Sort both the same way first, and a comparison in Text Diff shows real differences rather than the order the two lists happened to be written in.
Questions
Does my list leave this tab?
Why does é sort after z?
How does Numeric value decide the number?
Can I sort a CSV by one of its columns?
Is the shuffle properly random?
Why did my indentation disappear?
What happens to repeated lines?
Related tools
- Word Counter — Count words, characters, sentences and reading time.
- Case Converter — Switch between upper, lower, title, camel and snake case.
- Remove Line Breaks — Collapse hard wraps back into flowing paragraphs.
- Remove Extra Spaces — Normalise double spaces and stray whitespace.
- Remove Duplicate Lines — Delete repeated lines from a list.
- Find and Replace — Bulk replace text with optional regular expressions.