Sort lines
Alphabetical or reverse sorting for any list, with natural number order.
Paste a list with one item per line and sort it. Numbers inside the text are compared by value, so item 2 comes before item 10 — not after it, the way a plain sort would put them.
Alphabetize a list, the easy way
"Alphabetize my list" is the same operation as sort A→Z, and this is the tool for it: paste the names, words or lines in any order, press Sort A→Z, and they come back in alphabetical order. It works on a shopping list, a class register, a glossary, a bibliography, a list of book or film titles — anything with one item per line.
Two things it gets right that catch people out elsewhere. Case is ignored, so "apple" and "Apple" sort together instead of all the capitals coming first in a separate block — which is what a raw computer sort does and why an alphabetized list sometimes looks half-sorted. And numbers sort by value, so "Chapter 2" comes before "Chapter 10". If you need the reverse, Sort Z→A alphabetizes backwards.
Beyond alphabetical
The same list can be reordered other ways from here: by length shortest or longest first, shuffled into random order, reversed to flip the current order without re-sorting, and deduplicated to drop repeats. Sorting alphabetically first and then by length gives you length groups that are alphabetical inside each — a predictable, repeatable order.
Doing it without this tool
Excel: select the column and use Data → Sort A to Z. It sorts by value and case-insensitively by default, and it splits multi-line text into cells first, which you then have to manage.
Word: select the list and Home → Sort (the A-Z button). It handles paragraphs and has options for text versus number sorting.
Command line: sort file.txt alphabetizes but is case-sensitive and puts capitals first;
sort -f ignores case and sort -V handles numbers naturally.
Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.
How to use it
- Paste your list, one item per line.
- Press Sort A→Z to alphabetize, or Sort Z→A for reverse order.
- Case is ignored and numbers sort by value automatically.
- Copy the sorted list.
What this tool does
Each line of the box is treated as one item, and the list is reordered. Four buttons:
- Sort A→Z — ascending alphabetical order.
- Sort Z→A — descending.
- Remove duplicates — keeps the first occurrence of each line.
- Reverse order — flips the current order without sorting, which is not the same as Z→A on an unsorted list.
Sorting is case insensitive, so apple and Apple land next to each other instead of being separated into two blocks. That is what you want for a list a person will read. Empty lines are dropped so the result is a clean list. Comparison is locale-aware, so accented and non-Latin letters sort in their alphabet's own order rather than by raw code point — éclair sorts near eclair, not after z.
Natural sorting: why item2 comes before item10
A plain sort compares strings character by character. Since the character 1 comes before 2, a naive sort produces the order on the left:
| Plain string sort | Natural sort (used here) |
|---|---|
| item1 item10 item11 item2 item20 item3 | item1 item2 item3 item10 item11 item20 |
Natural sorting reads digit runs as numbers, so 2 is compared with 10 as values rather than as text. It is the order file managers use, and the order people expect from anything that has been numbered.
Where it matters:
- File names:
chapter2.mdbeforechapter10.md. - Versions:
v1.9beforev1.10. A plain sort gets this backwards, which is the classic version-number bug. - Numbered SKUs and invoice IDs:
INV-9beforeINV-100. - Timestamps are the exception: dates written as
2026-07-22sort correctly under either rule, which is exactly why ISO date format is worth using.
Examples
| Input | Action | Result |
|---|---|---|
| banana Apple cherry | Sort A→Z | Apple banana cherry |
| banana Apple cherry | Sort Z→A | cherry banana Apple |
| c a b | Reverse order | b a c |
| file10 file2 file1 | Sort A→Z | file1 file2 file10 |
| red blue red | Remove duplicates then Sort A→Z | blue red |
Note the third row: reversing an unsorted list only flips it end to end. If you want descending alphabetical order, use Z→A rather than sorting and then reversing — the result is the same only when the list was already sorted.
When you need it
- Making a list checkable. An alphabetical list of 200 names lets a person find an entry in seconds; an unsorted one does not.
- Comparing two lists. Sort both and a side-by-side diff shows real differences instead of reporting that everything moved.
- Grouping related items. Sorting URLs brings everything under the same path together, which makes structural problems visible.
- Tidying imports and configs. Sorted dependency and environment lists produce clean version control diffs.
- Finding duplicates by eye. After a sort, repeats sit next to each other.
- Bibliographies and glossaries. Alphabetical order is required, and doing it by hand invites mistakes.
Doing it without this tool
Excel
- Select the column.
- Data → Sort & Filter → A to Z, or Data → Sort for multiple keys.
- Choose Expand the selection when prompted, otherwise only that column moves and every row is scrambled — the single most common way to destroy a spreadsheet.
Excel sorts numbers stored as text as text, so item10 lands before item2. The workaround is a helper column that extracts the number with =VALUE(MID(...)) and sorting on that. In Microsoft 365 and Google Sheets, =SORT(A2:A100) gives a live sorted copy that leaves the original alone.
Google Sheets
- Data → Sort range → Advanced range sorting options, with a checkbox for a header row.
- Or Data → Sort sheet → Sort sheet by column A, A to Z to move whole rows.
Notepad++
- Edit → Line Operations → Sort Lines Lexicographically Ascending.
- The same menu has Sort Lines As Integers, which is the natural-sort equivalent for numbered lines.
Command line
sort file.txt— ascending;sort -rfor descending.sort -f— ignore case, which is what this page does by default.sort -V— version sort, the natural order foritem2beforeitem10.sort -n— numeric, for lines that are plain numbers.sort -u— sort and remove duplicates in one pass.sort -t, -k2— sort a CSV by the second field.- PowerShell:
Get-Content file.txt | Sort-Object.
One trap on the command line: sort obeys the locale, so results differ between LC_ALL=C sort (raw byte order, capitals first) and a normal UTF-8 locale. Set the locale explicitly in scripts if the order has to be reproducible.
Privacy: your text never leaves your browser
Sorting happens in JavaScript on your device. The list is never uploaded, never logged and never stored, and reloading the page clears it.
That is worth having when the list is names, email addresses, internal URLs or customer identifiers — which, for a sorting tool, it usually is.
Related tools
Frequently asked questions
No. Apple and apple sort next to each other, which is what you normally want for a list a person will read.
Naturally: item2 comes before item10, because runs of digits are compared as values rather than character by character.
No, empty lines are dropped during sorting so the result is a clean list with no gaps.
Sort Z to A puts the list in descending alphabetical order. Reverse order just flips the current order end to end, which only matches on an already sorted list.
Select the column and choose Data, then Sort A to Z. Always pick "Expand the selection" when prompted, or the other columns stay put and the rows are scrambled.
Use sort file.txt for ascending, sort -r for descending, sort -f to ignore case, sort -V for natural number order and sort -u to deduplicate at the same time.
Yes. Comparison is locale-aware, so accented Latin, Cyrillic and Greek letters sort in their own alphabetical order rather than by code point.