Utilities TOOL

Sort Lines

Sort a list of lines ascending or descending, with natural ordering that puts 2 before 10, an optional case-insensitive comparison, and options to drop duplicates and empty lines on the way. Sorting runs through the browser’s own collator, so accents and punctuation are handled the way your language handles them.

Processed locally in your browser — your file is never uploaded

UTILITYSort Lines
Processed locally
Input
Output

2 before 10. Without it, 10 comes before 2 because 1 is the smaller character.

Off, apple and Banana sort together. On, every capital letter sorts before every lower-case one.

Your text never leaves this page.

How sort lines works

  1. Paste the listOne item per line.
  2. Set the comparisonDirection, natural ordering, case, and whether to drop duplicates or blank lines.
  3. Take the sorted listDownload it, or copy it straight into the file you are editing.

What you get

Put a list in order, the way a person expects rather than the way a computer does. Everything happens inside this page: the file is read by your browser, transformed in memory and handed straight back to you as a download. There is no upload queue, no waiting for a server, and nothing left behind when you close the tab.

Supported formats

This tool works on text you paste or type, so there is no file format to worry about. Nothing you type is sent anywhere.

Limitations, stated up front

  • The order of lines that compare as equal is not guaranteed to be stable.
  • Sorting is on whole lines. To sort by a field within each line, extract that field first, or use the regular expression tester to work out what to keep.

Frequently asked questions

What is natural order?

Sorting that compares numbers as numbers. Plain sorting compares characters, so 10 comes before 2 because 1 sorts before 2. Natural order splits the text into runs of digits and letters and compares each part by its value, which gives the order a person expects from a version list or a set of measurements.

How are accents and punctuation handled?

Through the browser’s own collator for your language, so an accented letter sorts next to the plain one rather than at the end of the alphabet as a byte comparison would put it. Furtu does not strip accents, because in some languages they distinguish words.

Should I use case-sensitive sorting?

Not usually. With it on, every capital letter sorts before every lower-case letter, so Zebra comes before apple, which is rarely what anyone wants. Case-insensitive comparison is the default for that reason.

Is it a stable sort?

It is not guaranteed to be, and the browser does not promise it. For lines that compare as equal — two different lines with the same sort key, such as two accented variants in a base collation — their relative order can change. De-duplicating afterwards is the reliable way to collapse those.

Is my list uploaded?

No. Sorting is a local operation, so a list of internal identifiers is never transmitted.