Line Sorter

Paste a list, choose how it should be ordered, and copy the result. Blank lines and stray spaces can go at the same time, which is usually what a list pasted out of a spreadsheet needs.

Order
Sorted

Runs entirely in your browser. Your files are never uploaded.

How to use Line Sorter

  1. 1Paste your list, one item per line.
  2. 2Choose an order: A to Z, Z to A, by length, or reversed.
  3. 3Turn on numeric order if the lines start with numbers.
  4. 4Copy the sorted list.

Four orders

A to Z and Z to A sort alphabetically. By length sorts short lines first and falls back to the alphabet when two lines are the same length, so the result is predictable rather than dependent on the order you pasted.

Reverse does no sorting at all. It flips the list end to end, which is the quickest way to turn an oldest-first log into a newest-first one.

Why 9 sorts after 10 unless you ask

Alphabetical order compares characters, and the character 1 comes before 9. That puts 10 before 9, which is correct for text and wrong for quantities.

Numeric order reads the digits at the start of each line as a number, so 2, 9, 10 come out in that order. Leave it off for version strings and product codes, where character order is usually what you want.

Accents and capitals

Sorting uses your browser's language rules rather than raw character codes, so éclair lands between apple and zebra instead of after z. Capitals are ignored by default, which keeps Apple next to apricot; switch that off and every capital letter sorts ahead of every lowercase one.

Limits

  • Sorting is by whole line, so a column inside a CSV row cannot be the key.
  • Numeric order reads the number at the start of a line and ignores any later ones.
  • Language rules come from your browser, so an unusual alphabet may order differently elsewhere.

Frequently asked questions

Can I sort a CSV by its second column?
Not here. This sorts whole lines, so the first field decides the order. A spreadsheet is the right tool for sorting by an arbitrary column.
Will it remove duplicates while sorting?
That is a separate tool, Remove Duplicate Lines, which also reports how many it dropped. Sorting first and de-duplicating after works fine if you want both.
What happens to blank lines?
They are kept by default and sort to the top. Switch on the option to drop them and they are removed before sorting, along with lines holding nothing but spaces.