FreeToolsLand

Line Sorter

Sort a list alphabetically, and get item2 before item10 the way you meant.

Free, no signup, no limits

Sorted lines9 lines

apple Banana bread cherry item1 item2 item3 item10 item20 Zebra crossing

How to sort a list alphabetically

Paste it on the left. The sorted list appears on the right as you type.

Alphabetical is the default, Reverse flips the direction, and two other modes sort by line length or by the numbers inside each line.

Why item10 keeps landing before item2

Because a plain alphabetical sort compares one character at a time.

It reads item1 and item2, sees that 1 comes before 2, and stops. That makes item10 a smaller value than item2, because the comparison never gets past the fourth character. Every programming language does this by default, and every spreadsheet inherits it.

It is technically correct and it is never what anyone means. Sorting here compares runs of digits as numbers, so item1, item2, item3, item10, item20 come out in the order you would have written them.

This is the difference between what is usually called an alphabetical sort and a natural sort. The natural one is the default here because it matches what people ask for when they say alphabetical.

Capitals do not split the list

Apple, banana, Banana and cherry sort together.

A case-sensitive sort compares by character code, and every capital letter sorts before every lowercase one. The result is not one alphabetical list but two stacked on top of each other: all the capitalised entries first, in order, then all the lowercase ones, in order. Anyone scanning for a name finds nothing where they expect it.

The other two modes

Line length puts the shortest lines first. Useful for spotting the outliers in a list of headlines, product names or meta descriptions, where the ones at either end are usually the ones that need work.

First number in the line sorts by a number that is not at the start. A price, a score, a year, a count sitting in the middle of the line. Lines with no number in them go to the end rather than being treated as zero, since they are not smaller, they are absent.

Blank lines are removed

Once a list is sorted, the order is its structure. A blank line has nothing left to separate, and leaving them in stacks them all at the top, which reads as though the tool broke.

What usually comes next

A sorted list makes duplicates obvious, because they end up next to each other. The duplicate line remover takes them out and tells you which entries repeated and how often.

If the list still has its bullets and numbering, strip those first with the list cleaner, or the markers will sort before the content.

Everything runs in your browser. Nothing is uploaded.

Frequently asked questions

Something missing here?

If this tool almost does what you need, say what is missing. That is usually how the next version gets built.