Skip to content
Jellykit

Sort Lines

Put lines in alphabetical, natural, length or reverse order, using your language rules for accents and case.

  • Runs on your device
Loading tool

About Sort Lines

Sort a list of names, words or file names alphabetically from A to Z or Z to A. Natural order reads numbers as numbers, so Chapter 2 comes before Chapter 10, and you can also order lines from shortest to longest.

Sorting follows the conventions of your browser language, so accented letters sit beside their plain forms rather than after Z. Turn on "Ignore case" to keep lines that differ only in capitals in their original order.

How it works

  1. The text is split into lines at any kind of line break, and the ending used in the input is used again in the output.
  2. Clean-ups run in this order: non-printing characters, trimming, collapsing spaces, empty lines, duplicates, and finally the line order.
  3. Duplicates are compared after the earlier steps, keeping the first occurrence. Accented letters typed in different ways count as the same.
  4. Sorting uses your browser language rules, so accented letters sort next to their base letter. Shuffling uses the browser secure random generator.

Questions

Why is "item 10" before "item 2"?

That is plain alphabetical order, which compares character by character. Choose "Natural (2 before 10)" to compare runs of digits as numbers.

Are blank lines sorted too?

Yes, unless you turn on "Remove empty lines", in which case they are dropped before sorting. Blank lines sort to the top in A to Z order.

Is the sort stable?

Yes. Lines that compare as equal keep the order they had, which matters when case is ignored or when sorting by length.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.