Nothing you open here is ever uploaded

Sort lines of text

Paste a list and get it back in order. Alphabetical sorting compares character by character, which is right for words and wrong for numbers: it puts 10 before 9, because 1 comes before 9. The list still looks sorted, which is why the mistake usually survives. Switch on numeric sorting and the number inside each line is read and compared as a number, so 2, 9, 10, 100 come out in the order you expect.

This page loads no libraries at all — the work is done by the browser itself. Your file is read on your own machine and never sent anywhere — open your browser's network tab and watch while you use it.

Questions

Why does 10 come before 9?

Because alphabetical sorting compares one character at a time, and the character 1 sorts before the character 9. This is correct behaviour for text and wrong for a list of numbers, and it is the single most common complaint about sorting tools — the result looks ordered, so nobody checks. Tick "sort numerically" and the number in each line is read as a number instead.

What happens to lines that have no number in them?

In numeric mode they are moved to the end rather than dropped. Losing a line during a sort would be far worse than putting it in an awkward place, so nothing ever disappears; you can see immediately which lines had no number to compare.

Which number is used if a line has several?

The first one. A line like "12 apples at 3.50 each" sorts on 12. Negative numbers and decimals are both understood, and a comma is accepted as the decimal mark.

Is the sort case sensitive?

Not by default: Apple and apple sit next to each other rather than in separate blocks at opposite ends of the list, which is what the plain character order would do. Tick "match case" if you want the strict order, which is what code and identifiers usually need.

Other text & code tools

Everything here is free and works the same way — in your browser.