Sort Lines
Sort lines of text alphabetically, in natural or numeric order, by length, in reverse or at random, with optional duplicate removal.
Paste your lines and pick an order - the sorted list updates instantly.
More Text & Writing Tools
View all 28Alphabetical order depends on language rules; this tool uses your browser's sorting, which handles accents the way most people expect.
What Is the Sort Lines Tool?
It puts lines of text in order: alphabetically, in natural order, by the number in each line, by length, reversed or shuffled at random. Empty lines and duplicates can be removed in the same step.
Which Order to Choose
- Alphabetical - names, words and tags.
- Natural order - file names and versions, so chapter2 comes before chapter10.
- Number - lines such as prices, scores or "12 apples", sorted by the first number in each line.
- Length - spotting the shortest or longest entries.
- Random shuffle - quiz questions, running orders or a fair turn order.
How to Use It
- Paste your lines.
- Choose the order. The sorted result updates immediately.
- Tick the options you want and copy or download the result.
Example
The file names chapter10.txt, chapter2.txt, Chapter1.txt, chapter21.txt, chapter3.txt sorted alphabetically come out as chapter1, chapter10, chapter2, chapter21, chapter3 - because "1" sorts before "2" character by character. With Natural order they come out the way a person expects: Chapter1.txt, chapter2.txt, chapter3.txt, chapter10.txt, chapter21.txt.
Upper and Lower Case
By default, capital and small letters are sorted together, so apple and Apple sit side by side. Tick Case-sensitive to sort by exact character codes instead, which puts all capitalised lines first - the way many programming languages sort.
Limitations
Alphabetical order follows your browser's language rules, which handle accented letters well but may differ slightly from a dictionary in your language. Number sorting reads only the first number in each line, and lines without a number go to the end. To remove repeats without sorting, use Remove Duplicate Lines; to pick one line at random, use the Random Picker.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.