WordRoom Privacy

Clean up

Sort lines

Alphabetise, sort by length, reverse or shuffle — with natural number ordering and locale-aware collation.

Alphabetical is not one thing

Sorting looks like a solved problem until you sort real data. A naive sort compares code points, which puts every capital letter before every lowercase one — so "Zebra" sorts before "apple", and a list of names comes out in an order no human would call alphabetical.

This tool uses locale-aware collation instead, which is the same machinery your operating system uses to sort a file listing. Accented characters sort next to their base letters rather than at the end, and case is ignored by default because that is what people mean by alphabetical.

Natural number ordering is the other common surprise. Compared as text, "item 10" sorts before "item 2", because "1" is less than "2". Natural ordering compares the numeric runs as numbers, giving item 1, item 2, item 10. Leave it on for anything with numbers in it.

Sort modes

  • Alphabetical — locale-aware, case-insensitive by default. Turn on Descending for Z to A.
  • By line length — shortest first, ties broken alphabetically. Useful for spotting outliers in a list of keywords or headlines.
  • Reverse current order — flips the list without sorting it, which is what you usually want for a chronological log.
  • Shuffle — a Fisher–Yates shuffle, so every ordering is equally likely. Naive shuffles using a random comparator are biased.

Empty lines are dropped by default, since a sorted list with a block of blanks at one end is rarely what anyone wants. Switch it off if the blank lines carry meaning.

Common questions

Why did my list sort with capitals first?

That happens with tools that compare raw character codes, where every uppercase letter precedes every lowercase one. This tool uses locale-aware collation and ignores case by default, so you get the ordering a person would expect. Switch on Case sensitive if you need the strict version.

Why does item 10 come before item 2?

Compared as text, "1" is less than "2", so "item 10" sorts first. Turn on Natural number order to compare the numeric runs as numbers, which gives item 1, item 2, item 10. It is on by default.

Is the shuffle actually random?

It uses a Fisher-Yates shuffle, where every possible ordering is equally likely. Shuffling by passing a random comparator to a sort function is a common shortcut and produces measurably biased results.

Related tools