Sort Lines

Alphabetical, numeric, by length, or reversed. Case-insensitive and dedupe options included.

Sorted
—
Lines
—

Worked example

A plain string sort puts 100 before 9, because "1" sorts before "9". Numeric mode parses the leading number and compares values, which is what you want for prices, quantities and version lists.

Sorting a list looks like a solved problem until the list contains numbers, mixed case, accents or blanks. Each of those needs a different comparison function, and picking the wrong one produces an order that is stable but wrong.

Which mode to pick

Alphabetical with the case-insensitive flag is the right default for names and tags. Numeric is for anything where the digits are the value rather than an identifier — quantities, prices, scores. Length mode surfaces the longest or shortest entries, useful when auditing meta descriptions or tag lists.

Accents and case

This page sorts with localeCompare, which puts "ä" next to "a" rather than after "z" as raw character codes would. Turning off case-insensitive switches to a stricter comparison where uppercase sorts before lowercase, matching what a byte sort does.

Duplicates

The dedupe option keeps the first occurrence and drops later ones, comparing case-insensitively when that box is checked. Blank lines are removed separately, because a list pasted from a spreadsheet usually ends with one.