📋

Sort Lines

Sort any list alphabetically, in reverse, numerically or by line length. Free, instant, and runs entirely in your browser.

✓ Free forever✓ No signup✓ 100% private — runs in your browser
Sort Lines
Sort text lines in multiple ways: alphabetical, reverse, by length, numerical, or random shuffle.
Input (one item per line)
Output

A sorted list is easier to scan, easier to deduplicate, and easier to diff against another list. Sorting is also the quickest way to spot outliers — the shortest and longest entries, or values far outside the expected numeric range, end up at the ends.

How to use the Sort Lines

  1. Paste your list, one item per line
  2. Choose a sort: alphabetical, reverse, numeric or by length
  3. Copy the sorted result

Alphabetical is not the same as numeric

Sorting numbers alphabetically produces the classic wrong answer:

1
10
100
2
20
3

This is correct alphabetical order — character by character, '1' sorts before '2', so anything starting with 1 comes first regardless of magnitude. Numeric sort reads each line as a number and orders by value, giving 1, 2, 3, 10, 20, 100.

Use numeric sort for anything measured: prices, IDs, counts, version parts, timestamps.

Sorting by length

Less obvious but genuinely useful. Sorting by line length surfaces the extremes immediately — the truncated entries, the one row with a pasted paragraph in it, the keyword that is far longer than the rest.

It is a fast way to sanity-check exported data before importing it somewhere that enforces field limits.

Frequently asked questions

Why are my numbers in the wrong order?

You are using alphabetical sort on numeric data. Alphabetically, 10 comes before 2 because the character '1' precedes '2'. Switch to numeric sort.

How are uppercase and lowercase handled?

Sorting uses locale-aware comparison, so 'apple' and 'Apple' sort adjacently rather than uppercase letters all sorting before lowercase as they would in raw ASCII order.

Does sorting remove duplicates?

No, duplicates are kept and end up adjacent. Use the Remove Duplicate Lines tool first if you want them gone.

Are blank lines preserved?

Blank lines are treated as empty entries and group together. Remove them beforehand if they are not meaningful data.