Sort Lines
Sort lines alphabetically, naturally, numerically or by length, in ascending or descending order.
Paste or drop
Paste text below, or drop a file instead.
Choose an output
Sort lines alphabetically, naturally, numerically or by length, in ascending or descending order.
Fine-tune
Optional — sensible defaults are already set.
About Sort Lines
Sort a list of lines alphabetically, naturally, by numeric value or by length, in ascending or descending order. Natural sorting puts 'file2' before 'file10', which plain alphabetical sorting gets wrong because it compares the text character by character.
When it helps
- Alphabetizing a list of names, glossary terms or references.
- Ordering file names or version numbers the way people expect with natural sort.
- Ranking lines like '42 apples' by their leading number with numeric sort.
- Sorting by length to find the shortest or longest entries in a keyword or title list.
Tips
- Numeric sort reads the number at the start of each line, including decimals, negative numbers and thousands separators. Lines that do not start with a number go to the end.
- Alphabetical sorting uses language-aware rules, so accented letters sort next to their base letters instead of after Z.
- With 'Ignore case' off, uppercase lines sort before lowercase ones when the letters are otherwise the same.
- Empty lines are removed by default. Turn that off if blank lines need to stay in the output.
Good to know
Quick answers about sort lines in your browser.
Alphabetical sorting compares characters one at a time, and '1' comes before '2'. Choose 'Natural' or 'Numeric' to sort by the value of the numbers instead.
Not directly. Sorting always compares from the start of each line. Move the field you want to sort by to the front first, for example with find and replace using a regular expression.
Yes. There is no sign-up, no watermark and no limit on how many files you process.
No. Files are read and processed locally in your browser, so they never leave your device.
Related tools
Part of the Text Tools collection.