Sort lines of text
Paste your list and it sorts as you type. Every option re-applies straight away, and the text never leaves this tab.
- A to Z
- Z to A
- Shortest line first
- Longest line first
- Reverse the order they are in
The sorting runs in this tab as you type, so a list of names or passwords pasted here stays on your machine.
How to use it#
- Paste your list into the box above, one entry per line.
- Pick an order: alphabetical either way, by line length, or reversed.
- Tick numbers in value order if your lines are numbered, so item2 lands before item10.
- Copy the result, or download it as a text file.
Alphabetical is not as simple as it looks#
The obvious way to sort text compares the underlying character codes, and it gets the wrong answer constantly. In that scheme every capital letter sorts before every lowercase one, so Banana lands before apple. Accented letters sit past z entirely, which sends éclair to the bottom of a list of French words.
This uses the sorting rules your browser carries for human language instead. Capitals and lowercase interleave the way a person would expect, and an accented letter files next to its plain counterpart rather than in an appendix at the end.
Numbered lines, and why item10 comes before item2#
Alphabetical order reads a number one character at a time, so the 1 in item10 is compared against the 2 in item2 and wins. That is correct as text and wrong as a list, and it is the single most common complaint about any sorting tool.
Numbers in value order fixes it by reading a run of digits as the number it spells. Version strings, numbered files, invoice references and anything else counted rather than named all come out in the order you meant.
Sorting by length, and reversing#
Shortest and longest first order by how many characters are in the line rather than what they are. It is a quick way to find the outliers in a list: the truncated rows, the one entry someone pasted a paragraph into, the codes that came out a digit short.
Reverse is a different thing again. It does not compare anything, it just turns the list upside down, which is what you want when the order is already meaningful and you need it the other way round. Sorting a list Z to A and reversing a list are only the same operation if the list was in alphabetical order to begin with.
Cleaning as you sort#
Sorting tends to surface the mess in a list, because near-duplicates end up adjacent. Remove duplicates, trim spaces and remove blank lines run before the sort, so you can clean and order in one pass rather than pasting the result into another tool.
Every one of those composes with every other, and with the order and comparison settings. There is no combination that is unreachable, and the counts under the result tell you how many lines each pass took out.
Frequently asked questions#
Is my text uploaded anywhere?
#
No. The sorting happens in this tab as you type. Nothing is sent to a server, so a list of names, passwords or customer records stays on your device.
Why does item10 come before item2?
#
Because alphabetical order compares one character at a time, and the 1 in item10 sorts before the 2 in item2. Tick numbers in value order and a run of digits is read as the number it spells, which puts item2 first.
Are capital letters sorted separately from lowercase?
#
No. The tool uses your browser language sorting rules, so apple and Banana interleave the way a person would file them rather than putting every capital first. Ignore case removes the remaining distinction between two lines that differ only in capitalisation.
What happens to accented or non-English letters?
#
They file next to the plain letter they resemble, so éclair sits between apple and zebra rather than after z. The same rules handle scripts other than Latin.
Can I sort and remove duplicates at once?
#
Yes. Tick remove duplicates and the repeats go before the sort runs. The dedicated duplicate remover is the better choice when you want the repeats gone but the original order kept.
Does sorting change my line endings?
#
No. Unix, Windows and old Mac line endings are all read, and the result is written back with the ending your text arrived with, so a file pasted from Windows does not come back reformatted.