Sort Lines Alphabetically
Sort any list of lines alphabetically online, A-Z or Z-A. Handles numbers naturally and ignores case. Free, instant, no upload.
This tool sorts the lines of your text into alphabetical order, ignoring case and sorting embedded numbers by value rather than by digit. Tick the descending box to reverse the order to Z–A.
Examples
| Input | Output |
|---|---|
| cherry apple Banana | apple Banana cherry |
| item10 item2 item1 | item1 item2 item10 |
When to use the sort lines alphabetically
Sorting turns an unordered dump into something scannable — glossaries, bibliographies, import lists, CSV columns, package manifests.
Two details set this apart from a naive sort:
- Natural number ordering. A plain string sort puts
item10beforeitem2, because it compares the character "1" against "2". This tool compares embedded numbers by value, soitem2comes first — the ordering a human expects. - Case-insensitive comparison.
Bananasorts betweenappleandcherry, not before both. A raw ASCII sort would put every capitalised word ahead of every lowercase one.
Blank lines are dropped. If you also need to remove repeats, run the remove duplicate lines tool first — it preserves the original order, so sorting afterwards gives you a clean, ordered, unique list.
Frequently asked questions
Does the sorter handle numbers correctly?
Yes. It uses natural sorting, so item2 comes before item10. A plain alphabetical sort would put item10 first because it compares character by character.
Is sorting case-sensitive?
No. Uppercase and lowercase letters sort together, so Banana falls between apple and cherry rather than ahead of both.
How do I sort Z to A?
Tick the "Sort descending (Z-A)" checkbox above the input and the order reverses.
What happens to blank lines?
They are removed. Sorting a list with blank lines otherwise clusters them all at the top or bottom.