How to use the Sort Lines Alphabetically
- Paste your list with one item per line.
- Choose the sort order.
- Optionally remove duplicates and empty lines.
- Copy the sorted list.
Example
| Input | banana Apple cherry |
|---|---|
| Result | Apple banana cherry |
Sort orders
- A → Z and Z → A: alphabetical order.
- Shortest first and Longest first: by number of characters, with ties sorted alphabetically.
- Reverse current order: flips the list upside down without sorting it.
- Random shuffle: puts the lines in a random order, which is useful for raffles and quizzes.
Options that change the result
- Natural number sorting (on by default): puts “item 2” before “item 10” instead of after it.
- Case-sensitive (off by default): when it is on, uppercase letters come before lowercase ones. When it is off, “Apple” and “apple” sort together.
- Remove duplicates: keeps the first copy of each line and ignores case unless Case-sensitive is on.
- Remove empty lines (on by default): removes blank lines. Turn it off to keep them in the output.
Accented letters sort next to their plain forms, so “Éclair” appears among the E entries rather than at the end of the list.
Good uses
- Alphabetizing a bibliography, glossary, names list or keyword list.
- Sorting file names or version numbers, where natural number sorting helps.
- Ordering lines of code, such as imports or CSS rules, where order does not change behaviour.
- Finding the longest or shortest item in a list.
Related tools
To count how often each line repeats, use the Remove Duplicate Lines. To compare two sorted lists, use the Compare Lists. To add numbers or bullets after sorting, try the Add Prefix & Suffix to Lines.
Frequently asked questions
What is natural sorting?
Natural sorting compares numbers inside text by value, so “file 2” comes before “file 10” instead of after it.
Is sorting case-sensitive?
No, by default sorting ignores case and accents so that “apple” and “Apple” sort together.
Does it sort numbers correctly?
Yes, with Natural number sorting on, which is the default. The values 2, 10 and 100 sort in numeric order instead of as text.
Does the sort depend on my language?
It uses your browser’s language rules for ordering, so letters with accents and alphabets such as Greek or Cyrillic sort in a sensible order for your locale.