What this alphabetical sorter does
It takes a list and puts it in alphabetical order. You can sort from A to Z, from Z to A, or by length. It works on lines, on single words or on comma separated items, and it handles the cases that trip up simple sorting: capital letters, accented letters and numbers inside text.
Everything happens in your browser. Nothing you paste is sent anywhere.
How to sort a list
- Paste your list into Your list. The tool starts with a short example so you can see how it behaves.
- Pick an Order: A to Z, Z to A, Shortest first or Longest first.
- Tell it how the items are separated: New lines, Commas or Spaces (words).
- Switch options on or off. Ignore case, Numbers in number order and Remove blank lines are on by default. Ignore A, An and The and Remove duplicates are off.
- Press Copy, or Download to save a text file.
The note under the tool tells you how many items were sorted and how many duplicates were removed.
Examples
This is the example list the tool opens with, sorted with different settings:
| Settings | Result |
|---|---|
| Default (A to Z) | Apple, banana, cherry, item 2, item 10, mango, The Beatles |
| Z to A | The Beatles, mango, item 10, item 2, cherry, banana, Apple |
| Ignore A, An and The on | Apple, banana, The Beatles, cherry, item 2, item 10, mango |
| Numbers in number order off | Apple, banana, cherry, item 10, item 2, mango, The Beatles |
The results are shown here on one line to save space. In the tool they stay one item per line.
A few more:
| Input | Settings | Result |
|---|---|---|
| pear, fig, apple, kiwi | Commas | apple, fig, kiwi, pear |
| the quick brown fox jumps | Spaces (words) | brown fox jumps quick the |
| ccc, a, bb (one per line) | Shortest first | a, bb, ccc |
| Zoe, adam, Émile, Eva (one per line) | A to Z | adam, Émile, Eva, Zoe |
| b, B, a, b (one per line) | Remove duplicates | a, b |
How the sorting works
The sorter uses the same comparison rules your browser uses for English text, through a feature called Intl.Collator. That gives it a few useful habits.
- Case does not change the order. “apple” and “Apple” sort together, not in two separate groups. When two items differ only by case, the capitalized one comes first.
- Accents are treated as their base letter. “Émile” files under E, next to “Eva”, instead of being pushed to the end of the list.
- Numbers sort by value. With Numbers in number order on, “item 2” comes before “item 10”, and “Chapter 9” before “Chapter 12”. This is often called natural sorting.
- Articles can be skipped. With Ignore A, An and The on, “The Beatles” sorts as “Beatles”. Only the comparison changes. The item itself is not edited.
When you sort by words, punctuation stuck to the start or end of a word is removed, so “fox.” and “fox” are treated as the same word. When you sort by commas, a semicolon or a line break also counts as a separator.
Remove duplicates keeps the first copy of each item. With Ignore case on, “Banana” and “banana” count as the same item. Turn Ignore case off if they should both stay.
Tips
- Sorting numbers only? The number sorter is better for a list of plain numbers. It handles negatives and decimals and gives you the sum and average too.
- Need the list without repeats but in its original order? Use the duplicate line remover instead. It removes repeats without sorting.
- Want the order flipped later? Choose Z to A, or paste the sorted list into the reverse text generator and pick Line order.
- Names with surnames. The tool sorts by the first character of each line. To sort “Ada Lovelace” by surname, rewrite the list as “Lovelace, Ada” first. The find and replace tool can do that in one step with a regular expression.
- Mixed languages. The rules are tuned for English. Lists in other languages still sort sensibly, but a few letters may not land exactly where a native dictionary puts them.
Other ways to sort alphabetically
Microsoft Word. Select the lines, then go to Home and click the Sort button (the A to Z icon with an arrow). Choose Paragraphs and Text, then Ascending. Word sorts each paragraph as one item.
Google Docs. There is no built-in sort. You can install a sorting add-on, or paste the list into Google Sheets, sort it there and paste it back.
Excel and Google Sheets. Put one item per cell in a column, select it, then use Data and Sort A to Z. In a formula, =SORT(A1:A20) returns the sorted list in Google Sheets and in Excel 365. Note that spreadsheets sort “item 10” before “item 2” unless the numbers are in their own column.
Code. In JavaScript, list.sort((a, b) => a.localeCompare(b, 'en', { numeric: true })) gives the same natural order as this tool. In Python, sorted(items, key=str.lower) ignores case, but it does not sort numbers inside text by value.
For a quick list from an email, a chat or a document, pasting it here is usually the fastest way.