FileToolHub

Sort lines of text online

Alphabetizing a list by hand is slow and error-prone. Paste your list — one item per line — choose ascending or descending order, and get a sorted result instantly. Everything runs locally in your browser using JavaScript's string comparison; nothing you paste is sent anywhere.

Sorting is alphabetical, not numeric

Lines are compared as text, which produces the classic surprise with numbers: 10 sorts before 2, because the character '1' comes before '2'. That is correct string behaviour, not a bug, but it catches people out with numbered lists and version numbers. Padding numbers with leading zeros — 02 rather than 2 — makes text sorting produce numeric order, which is the standard workaround.

Locale-aware comparison

Comparison uses locale-aware collation rather than raw character codes, which means accented characters sort next to their base letters rather than being dumped after Z. That matters for names and for any list containing non-English words. It also handles case more sensibly than a naive comparison, grouping 'apple' and 'Apple' together rather than separating all capitals from all lowercase.

Sorting does not deduplicate

Identical lines end up adjacent after sorting but they are all still there. If you want them collapsed, run the duplicate line remover — usually before sorting, since deduplicating a sorted list and sorting a deduplicated list give the same result but the first is easier to sanity-check.

Frequently asked questions

How are numbers sorted?
Sorting uses standard locale-aware string comparison, so numbers are sorted as text ("10" comes before "2") rather than numeric value.
Are duplicate lines removed while sorting?
No, sorting only reorders lines. Use the duplicate line remover first if you also want duplicates removed.
Is my list sent anywhere?
No, sorting happens locally in your browser using JavaScript. Nothing is transmitted.
How do I sort a numbered list correctly?
Pad the numbers with leading zeros so every entry has the same width, or sort in a spreadsheet where the column can be typed as numeric.
Are blank lines kept?
Yes, they sort to the top since an empty string precedes any text.

Related tools