How to use Sort Lines Alphabetically
- Paste your list into the box, one item per line.
- Choose A to Z or Z to A, then turn on the options you need.
- Copy the sorted list or download it as a text file.
Features
- Sort lines alphabetically in ascending or descending order
- Natural order option so file2 comes before file10
- Case-sensitive or case-insensitive sorting
- Option to remove duplicate lines and empty lines while sorting
- Uses your page language for accented letters, so Spanish ñ follows n
Supported formats and limits
- Maximum input: 5,000,000 characters
Examples
| Input | Result |
|---|---|
| pear Apple banana | Apple banana pear |
| file10 file2 file1 | With natural order on: file1 file2 file10 |
| b a B a | With "remove duplicates" on (case-insensitive): a b |
Limitations
- Sorting follows the rules of your page language, so the order of accented letters and punctuation can differ from a plain code-point sort. Equal lines under the chosen case option keep their original relative order.
Learn more
Sorting a list alphabetically makes it easier to scan, compare and deduplicate. It is a common step when you tidy names, keywords, product codes, bibliography entries or configuration values that were collected in random order.
Two details change the result more than people expect. First, how numbers are treated: a plain alphabetical sort puts "file10" before "file2" because it compares character by character, while natural order compares the whole number. Second, how capital letters are treated: many sorts place every uppercase letter before every lowercase one. This tool lets you decide both, and uses the collation rules of the page language so accented letters land where a dictionary would put them.
Frequently asked questions
How do I sort lines from Z to A?
Choose the Z to A button. The tool sorts the list alphabetically and then reverses it.
What does natural order do?
It compares the numbers inside lines by value, so "file2" is placed before "file10" instead of after it.
Is the sort case-sensitive?
By default no: "a" and "A" are treated as equal. Turn on case sensitive and lowercase letters are placed before uppercase ones for the same letter.
Can it remove duplicates while sorting?
Yes. Turn on "Remove duplicate lines" and only the first of each group of identical lines is kept. The page shows how many lines were removed.
Last reviewed: September 30, 2026