Text & String

Sort Lines Alphabetically

Sort pasted lines A to Z or Z to A. The comparison is alphabetical, so the line 10 sorts before the line 2. Numeric sort is not offered.

Alphabetical only. 10 sorts before 2. Blank lines stay.

What the result means

The result is the same set of lines in alphabetical order. A to Z uses English localeCompare, and Z to A reverses that comparison. Ignore case affects the comparison only, so the original spelling of each line is what you get back. Blank lines are not removed. They sort along with the other lines. The limit that catches people is numbers. Numeric sort is not supported, so the line 10 sorts before the line 2, because the character 1 comes before the character 2. Punctuation and spaces take part in the comparison. The tool sorts whole lines, not the words inside a line.

Related tools

Guides

Advertisement

Questions

Does this sort numbers correctly?

No. Numeric sort is not supported, so "10" sorts before "2". The comparison is alphabetical, in English, and the digit 1 comes before the digit 2. A shorter number is not treated as a smaller value.

Are blank lines removed?

No. Blank lines stay in the list and are sorted with everything else. There is no option to drop them. An empty line is still a line after the paste is split.

What does ignore case change about the sort?

It compares letters without regard to case, and it does not rewrite the line you get back. When two lines tie under that comparison, their original order is kept before a Z to A reversal. The direction control still flips A to Z into Z to A.

Need help with a tool or found a bug?

Report an issue directly to engineering. No accounts required — all client data remains private on your device.

Report an Issue →