Sort Lines
Order a list alphabetically, numerically, by length, in reverse, or shuffle it at random.
Processed on your device — no upload
How to sort lines
- Paste your list, one item per line.
- Choose the order you want.
- Copy the sorted result.
How it works
Alphabetical sorting uses the browser's locale-aware comparison with numeric collation switched on. That second part matters more than it sounds: a plain text sort puts “item 10” before “item 9”, because it compares character by character and “1” sorts before “9”. Numeric collation reads the digits as a number and orders them the way a human expects.
Locale awareness also means accented letters sort next to their base letter rather than after Z, and non-Latin scripts sort by their own conventions instead of by code point.
Numeric mode is different: it extracts the first number found anywhere in each line and sorts on that, ignoring the surrounding text. It is what you want for lines like Invoice 1043 — Amman. Lines with no number are placed at the end rather than being treated as zero, which would scatter them through the results.
Shuffle uses a Fisher–Yates shuffle, which gives every possible ordering the same probability. The naive alternative — sorting with a random comparator — is biased and produces noticeably non-random results.
A worked example
You have a list of file names to put in order:
chapter 9.txt
chapter 10.txt
chapter 1.txt
chapter 2.txtChoose A → Z. The result is 1, 2, 9, 10 — correct, because numeric collation is on. A plain sort, which is what a spreadsheet or a naive script gives you, would produce 1, 10, 2, 9. This is the single most common frustration with sorting file names, and it is fixed here by default.
Now a different list: invoice lines like Invoice 1043 — Amman — 240 JOD. Choose Largest number first and the lines order by invoice number descending — the tool takes the first number in each line, which is 1043, not the 240 at the end. Worth knowing when your lines contain more than one figure.
For a prize draw, paste the entrant list and choose Shuffle randomly. Press Shuffle again to redraw without retyping anything. The first line is your winner.
If the list has repeated entries, deduplicate before sorting — that order keeps the first occurrence of each rather than an arbitrary one.
Questions
Does it alphabetize as well as alphabetise?
Same operation, two spellings. Sorting is locale-aware, so accented letters land where a reader expects rather than being pushed after Z.
How do I alphabetise a list?
Choose alphabetical and the lines are sorted A-Z. Reverse gives Z-A. The sort is locale-aware, so accented letters land where a reader expects rather than after Z.
Why does my spreadsheet sort "item 10" before "item 9"?
Because a plain text sort compares character by character, and "1" comes before "9". This tool uses numeric collation by default, so numbers inside text sort the way a human expects.
Is my list uploaded?
No. Sorting runs in your browser, and this site has no backend to send anything to.
What is the difference between A→Z and numeric mode?
A→Z sorts the whole line as text, with numbers inside it handled sensibly. Numeric mode ignores the text entirely and sorts on the first number it finds in each line.
Where do lines with no number go in numeric mode?
At the end. Treating them as zero would scatter them through the results, which is almost never what you want.
How random is the shuffle?
It uses Fisher–Yates, which makes every possible ordering equally likely. The common shortcut of sorting with a random comparator is measurably biased.
Does it sort accented and non-Latin text correctly?
Yes. The comparison is locale-aware, so accented letters sort beside their base letter and other scripts follow their own conventions rather than code point order.
Does sorting remove duplicates?
No — duplicates end up next to each other, which makes them easy to spot. Use the deduplicate tool to remove them.
Are blank lines preserved?
Yes, they are sorted along with everything else and typically gather at the top. Clean them first with the whitespace tool if they get in the way.
Related Text tools
Word Counter
Words, characters, reading time
open$termiva case --to titleCase Converter
UPPER, lower, Title, camelCase
open$termiva unwrap --keep-paragraphsRemove Line Breaks
Unwrap text into flowing lines
open$termiva dedupe --ignore-caseRemove Duplicate Lines
Keep one of each line
open