Sort lines of text
Put a list in order: A to Z, Z to A, natural number order, shortest first, by the number on each line, or shuffled.
- Free, unlimited
- 100% on-device
- No sign-up
Sort lines of text
Result
| # | Word | Count | Share | Bar |
|---|
Three steps — nothing to install
Paste the list
One item per line. Leading spaces are ignored for comparison but kept in the output.
Pick the order
Alphabetical, natural, numeric, length, reversed, shuffled, or drop duplicates while sorting.
Copy the result
The sorted list is ready to copy or download; nothing is uploaded.
Natural order versus character order
A plain character sort puts item 10 before item 2, because the character 1 comes before 2. That is technically correct and almost never what people mean. Natural order compares the runs of digits as numbers, so item 2, item 9, item 10 come out in the order a person reads them.
Sorting uses the browser's locale-aware collator, so accented letters sort next to their unaccented forms and case is ignored when you ask for it. That also means the exact order of punctuation differs slightly between languages, which is correct behaviour rather than a bug.
Sorting by a number on the line
The numeric modes read the first number they find on each line, so 12 apples sorts as twelve and 2.5 kg sorts as two and a half. Thousands separators are ignored. Lines with no number at all go to the end, because there is no honest place to put them in a numeric order.
If the number you want to sort by is not the first one, split it out first — with the find and replace tool or a spreadsheet — then sort. Guessing which number matters is how sort tools produce surprising results.
Shuffling, duplicates and ties
Shuffle uses the browser's cryptographic random generator and a Fisher–Yates shuffle, so every ordering is equally likely. That matters for sampling a list or drawing names; a Math.random shuffle is good enough for a playlist and not for a draw.
Modern browsers keep equal elements in their original order when sorting, so ties stay stable. The de-duplicate option removes repeated lines during the sort, which is a quick way to turn a messy export into a clean one. For a dedicated pass, use remove duplicate lines.