At One Place

Sort lines alphabetically

Sort a list of lines A–Z, Z–A, by length, or numerically.

How it works

Sorts pasted lines. Alphabetical sorting uses your locale’s collation rules rather than raw character codes, so accented characters land where a person would expect them rather than after Z.

Numeric sort is the one worth knowing about. A plain alphabetical sort puts 10 before 2, because it compares character by character and "1" comes before "2". Numeric mode reads the leading number on each line and orders by value, which is what you want for anything with figures in it.

Natural sort splits the difference: it handles text with embedded numbers, so file2 comes before file10 rather than after it.

This tool runs entirely in your browser. Nothing you enter is sent to a server, logged or stored, and the page keeps working with the network disconnected.

Common questions

Why is 10 sorting before 2?
Alphabetical sorting compares one character at a time, and "1" comes before "2". Switch to numeric or natural sort to order by value.
What is natural sort?
It treats runs of digits as numbers, so file2 comes before file10 instead of after it. Ordinary alphabetical sort gets this backwards.

Related pages