Sort lines alphabetically
Sort lines A to Z, in natural order, by number value, by length or in reverse locally. Locale and case settings affect the order.
Runs entirely in your browser
Paste lines to begin.
Text up to about 5 MB. The result updates as you type; very long lists update a moment after you stop typing.
How to sort lines alphabetically
- Paste your list into the box, one item per line, or open a .txt file.
- Choose how to sort and which way: A to Z or Z to A. Tick the clean-up options you want.
- Copy the sorted list or download it as a .txt file.
Putting a list in alphabetical order
Each line of the input is one item. The tool sorts the lines and shows the result next to the input as you type, so you can try a different order or option and see the effect straight away. Lines are compared whole, from the first character, so a list of names sorts by first name unless the surname comes first on each line.
Alphabetical sorting uses your browser's language rules, which handle accents and mixed case sensibly. Natural order suits file names, chapter titles and version numbers. Character code order matches what many programming tools and spreadsheets do with a plain sort: every capital letter comes before every lower-case one.
Numbers (by value) reads the first number on each line, such as -10, 1.05, $1,250 or 12.5%, and sorts by its value. A comma counts only as a thousands separator, so write decimals with a point. Lines without a number go to the end, and the summary under the options says how many there were.
When two lines compare as equal, for example "Apple" and "apple" with Ignore case on, they stay in the order they were in, so sorting twice gives the same result.
Tips
- Strip numbering or bullet characters before sorting with Find and replace, so they don't decide the order.
- Check what changed between two versions of a list with Compare text.
- Need the list on one line again? Use Remove line breaks with a comma as the separator.
Run this job in code with the paid API. Sort lines alphabetically API.
Questions
How are accented letters and other languages sorted?
Lines are compared with your browser's language-aware sorting rules, so é sorts next to e and Ä next to A rather than after Z. The order follows the language your browser is set to, which matters for a few letters: in Swedish, for example, Ä comes after Z.
What is natural sort?
Natural sort reads runs of digits as numbers, so "item 2" comes before "item 10". Plain alphabetical order compares one character at a time and puts "item 10" first, because 1 comes before 2. Natural sort does not read decimal points or minus signs, so it puts 1.5 before 1.25 and -5 before -10. For prices, measurements and other amounts, choose Numbers (by value).
What does Ignore case do?
With Ignore case on, "apple" and "Apple" are treated as the same word for sorting, and lines that differ only in case keep their original order. With it off, lower-case comes before upper-case when the letters are otherwise equal. Character code order is different again: it puts all capital letters before all lower-case ones, the way many programs do.
Can I remove duplicates while sorting?
Yes. Tick Remove duplicate lines and only the first copy of each line is kept. When Ignore case is on, lines that differ only in capitals count as duplicates. For more control, such as keeping the last copy, use Remove duplicate lines.