Sort Lines Alphabetically
Paste one item per line and the list is sorted alphabetically as you type, ignoring case, with options for Z–A, natural number order, line length, duplicates and empty lines.
0 words 0 characters 0 lines
Continue with this text: Remove duplicatesAdd line numbersMake a comma list
Your text stays in your browser: nothing is uploaded or stored on a server.
How to sort your list
- Paste or type the list into Your list (one item per line), or use Open file for a .txt or .csv file. Example loads a short test list.
- Pick a mode in Sort by. The result updates as you type or change an option.
- Tick Descending for Z–A, largest first or longest first.
- Leave Remove empty lines on (the default) and tick Remove duplicates if repeats should go.
- Click Copy, or Use as input to keep working on the sorted list, for example with the line numbering tool.
The six sort modes
| Mode | How lines are ordered | Example result |
|---|---|---|
| Alphabetical (A–Z) | Letter by letter, ignoring case; accented letters sort next to the plain letter | apple, eclair, Éclair, Olive, Zebra |
| Natural (2 before 10) | Like Alphabetical, but runs of digits are compared as whole numbers | file1, file2, file10, file20 |
| Number at the start | By the number that opens the line; lines without one go last, A–Z | -3, 2, 7.5, 10, $40, 1,200 |
| Line length | By number of characters, shortest first; equal lengths alphabetically | fig, kiwi, pear, apple, banana |
| Reverse current order | Last line first, nothing else changes | three, two, one |
| Random order | A shuffle in which every order is equally likely | changes every time |
Alphabetical sorting uses your browser’s built-in collation for your language setting, so it follows dictionary order rather than computer code order. “Zebra” no longer lands before “apple” just because it starts with a capital, and “Éclair” sorts with the E words instead of after Z.
Options and how they combine
| Option | What it changes |
|---|---|
| Descending (Z–A, longest first) | Reverses the sorted result. Has no effect on Reverse and Random. |
| Case-sensitive (Apple before apple; keep both when removing duplicates) | Lines that differ only in case are ordered capital first (Apple, apple), and Remove duplicates keeps both. Lines that differ in letters still sort alphabetically: apple, Olive, Zebra, zoo. |
| Ignore leading quotes, bullets and symbols | Alphabetical and Natural modes skip spaces, quotes, brackets, *, #, dashes, • and periods at the start of each line when comparing. Number at the start skips bullets followed by a space (-, *, •, –, —) before reading the number. The lines themselves are not changed. |
| Remove empty lines | Drops blank lines and lines that contain only spaces or tabs. On by default. |
| Remove duplicates | Keeps the first copy of each line, before sorting. |
Duplicates are compared after trimming the ends and collapsing repeated spaces, so New York, new york and New York count as one line, and the first one in your list is the one kept, spelled as you typed it. For a duplicate remover that keeps your original order, use Remove duplicate lines.
Rules and edge cases
- Ties keep your order. When two lines compare as equal (with case ignored, “Apple” and “apple” do), they stay in the order you entered them. Descending reverses everything, ties included.
- Empty lines go to the top. With Remove empty lines off, blank lines sort before everything else in ascending order.
- Leading spaces count. A line that starts with spaces sorts before the letters. Tick Ignore leading quotes, bullets and symbols to skip them.
- Punctuation before digits before letters. In Alphabetical mode
_underand!bangcome before123, which comes beforeabc. - Number at the start reads only a number that opens the line. Spaces and one of
(["'#$€£¥may come before it, so$1,250,#2and(5)all count. A minus or plus sign directly before the digits counts (-3,−1), commas are read as thousands separators (1,200) and a decimal part is read (7.5). Lines that do not start with a number, such asRoom 3,item-5orversion 1.9, go after the numbered lines in both directions (A–Z, or Z–A with Descending); use Natural for those. A date such as2024-10-21 reportis read as 2024. - Bullets need the ignore-leading option; signs may come before a currency symbol. With Ignore leading quotes, bullets and symbols ticked, Number at the start skips bullets followed by a space, so
1 kiwi,* 3 figs,- 5 pears,• 12 applessort as 1, 3, 5, 12. Without it,- 5 pearsand• 12 applescount as lines without a number. A sign before the currency symbol counts in either case:-$5 refundsorts before−€3and$10. - Natural ignores minus signs and decimal points. It reads
-10as 10 and1.25as 1 and 25. For signed numbers and decimals, use Number at the start. - Line length counts characters as you see them. An emoji such as 👍🏽 counts as one character.
- Line endings. Windows, Mac and Unix line breaks are all accepted; the result uses plain line feeds.
Worked examples
The tool’s sample list with the default settings, then with Natural and Remove duplicates:
| Before | Alphabetical | Natural + Remove duplicates |
|---|---|---|
| banana, Apple, cherry, apple, (blank), Date 10, date 2, Banana, elderberry | Apple, apple, banana, Banana, cherry, Date 10, date 2, elderberry | Apple, banana, cherry, date 2, Date 10, elderberry |
Chapter titles, Alphabetical compared with Natural:
Alphabetical Natural
Appendix Appendix
Chapter 1 Chapter 1
Chapter 10 Chapter 2
Chapter 11 Chapter 10
Chapter 2 Chapter 11
A price list with Number at the start and Descending:
$1,250 laptop
$399 monitor
$89 headphones
$15 cable
An email list with Remove duplicates (case ignored): [email protected], [email protected], [email protected], [email protected] becomes [email protected], [email protected], [email protected].
When people need it
- Alphabetizing a list for Word, Google Docs or a notes app. Copy the list out, sort it here and paste it back. Bullets pasted as text (
•,-,*) are handled by the ignore-leading option. For more ways to do it, see the guide how to alphabetize a list. - Cleaning an export. Email addresses, tags or product names from a CRM or spreadsheet usually contain repeats and blank rows; tick Remove duplicates and keep Remove empty lines on.
- File names and chapters. Natural mode orders
IMG_2.jpgbeforeIMG_10.jpg. - Keyword and hashtag lists. Sort by length to find the longest phrases, or alphabetically to spot near-duplicates sitting next to each other.
- Preparing code or data. Sort values, then join them with the comma separator for an SQL
IN (...)list or a CSV row. - Random order for drawing names or mixing quiz questions; to pick just one or a few lines, use the random line picker.
The tool sorts whole lines by their beginning. It does not sort by a column, by the last word, or skip words such as “The”; to sort a list of names by surname, write them as “Last, First” first.
Questions
How do I alphabetize a list?
Paste the list with one item per line. It is sorted A–Z straight away with the default mode, Alphabetical. Click Copy and paste the result back into your document, spreadsheet or notes app.
How do I sort Z to A?
Tick "Descending (Z–A, longest first)". It reverses the result of whichever mode you picked, so it also gives largest numbers first and longest lines first.
Why does 10 come before 2?
Alphabetical order compares text character by character, and "1" comes before "2". Choose "Natural (2 before 10)" to compare whole numbers inside the lines, or "Number at the start" for lists of values such as prices.
Are uppercase and lowercase sorted separately?
No. By default "apple" and "Apple" count as the same word and stay in the order you typed them. With "Case-sensitive" ticked, the capitalized version comes first when two lines differ only in case, but capitals are not moved ahead of all lowercase lines.
Can I sort by last name?
Not directly; the tool sorts by the start of each line. Write names as "Last, First" (for example "Lee, Kim") and they sort by last name.
Does it ignore "The" and "A" at the start of titles?
No. "The Who" sorts under T. The "Ignore leading quotes, bullets and symbols" option skips punctuation only, not words.
Is my list uploaded anywhere?
No. Sorting runs in your browser and the text is not sent to a server.