Sort Lines Alphabetically
Sort lines alphabetically online free. Real A-Z dictionary order, natural number order (item9 before item10), sort by length or number, remove duplicates — in your browser.
Runs in your browserNothing uploadedFree · no signup
Alphabetical order uses your chosen language's real dictionary order, not the order of the underlying character codes — so apple comes before Banana, and an accented letter files with its plain form instead of after Z. Blank lines are dropped and each line is trimmed; nothing else about a line is changed. Need to strip repeats without reordering? Use Remove Duplicate Lines.
Frequently asked questions
- Why do other sorters put Banana before apple?
- Because they call JavaScript's built-in sort with no comparator, which compares characters by their numeric code. Every ASCII capital letter has a lower code than every lowercase letter, so all the capitalised words end up in a block before all the lowercase ones, and an accented letter like Ä lands past Z. That is not alphabetical order in any language. This tool sorts with Intl.Collator instead, the browser's implementation of real dictionary order, so apple comes before Banana and Ärger files with A.
- How do I get item9 to sort before item10?
- That is on by default — it is the 'Read digits as numbers' option. Compared character by character, the '1' in item10 beats the '9' in item9, so a plain sort files item10 first. With the option on, a run of digits is compared as a single number, which puts item1, item9, item10 in the order you expect. Turn it off if you want strict character order, for example when you need to match what a database or a shell script produced.
- Can it sort a comma-separated list?
- Yes. Set 'Items are separated by' to Commas and paste something like banana, apple, cherry. Each item is trimmed, sorted and joined back with a comma and a space, so you get a tidy list you can drop straight back into a sentence or a spreadsheet cell.
- What happens to blank lines and duplicates?
- Blank lines are always dropped, which is what stops the trailing newline on a pasted list from becoming an empty first line in the result. Duplicates are kept unless you tick 'Remove duplicates', and when you do, they are matched using the same case rule as the sort — so a case-insensitive sort treats Apple and apple as one item. The count of what was dropped is shown under the options.
- Does sorting change the lines themselves?
- No. Options like ignoring case, ignoring a leading 'The' or reading a number out of a line only build the key used for comparing; the line is copied to the output exactly as you typed it, minus leading and trailing spaces. The only settings that change content are the ones that say so — dropping blanks and removing duplicates.
- Is my list uploaded anywhere?
- No. Sorting runs entirely in your browser and nothing is sent to a server, so a list of names, emails or customer records never leaves your device.