Sort lines

Paste a list and sort it — and choose which of the two correct orders you meant, because they are not the same. Nothing you type here leaves your browser. It is worked out on your own device, so there is nothing to send and nothing to log — which matters more for text than for most things, because people paste in work they are not supposed to paste anywhere.

There are two right answers and most tools pick one

Sort banana, Apple, cherry, apple, Banana and you can correctly get either of these:

Code pointApple, Banana, apple, banana, cherry
Dictionaryapple, Apple, banana, Banana, cherry

Code point order is what a computer does unless told otherwise: it compares the numbers behind the characters, and every capital letter has a lower number than every lowercase one. So Zebra comes before apple. That is what a programming language's sort gives you, and it is the right answer when you are sorting identifiers or matching another program's output.

Dictionary order is what a person expects, and it uses your browser's own language rules — so it knows where accented letters belong, which varies by language. That is the right answer for a list of names.

And a third, for anything numbered

Plain sorting puts item10 before item9, because it compares character by character and “1” comes before “9”. Natural order reads a run of digits as a number, so you get item1, item2, item9, item10 — which is what anybody looking at a list of files meant.

Sorting destroys the order it found

If the order meant something — a log, a sequence of steps, a ranking somebody made on purpose — sorting throws it away and nothing here can put it back. Worth a copy first.

Where to go next