Sort Text Lines
Paste lines and get them sorted instantly, A–Z, numerically or by length.
Options
Sorted lines
How to sort lines
Paste your lines into Your lines, or press Load example. Pick
Alphabetical, Numeric or By length, choose ascending or
descending order, and the sorted lines appear instantly. Copy the result or download it as a
.txt file. Everything runs in your browser, so nothing you paste is uploaded.
Examples
| Mode | Input | Output |
|---|---|---|
| Alphabetical | banana Apple cherry | Apple banana cherry |
| Numeric | 10 2 1 | 1 2 10 |
| By length | aaaa b cc | b cc aaaa |
Limits and edge cases
- Duplicate removal is case-sensitive and exact:
Appleandapplecount as different lines. - Numeric mode reads the leading number of each line (
10pxsorts as 10). Lines without a leading number sort alphabetically after the numbered lines in ascending order. - Sorting is stable: lines that compare equal keep their original order.
- Alphabetical order follows English locale rules (
localeComparewithen). Emoji and accented characters sort without errors but may not follow every language's rules.
Frequently asked questions
How do I sort lines alphabetically?
Paste your lines into the input box, keep the Alphabetical mode and Ascending order, and the sorted lines appear instantly. Copy the result or download it as a .txt file.
Why does numeric mode sort 2 before 10 but alphabetical mode does not?
Alphabetical mode compares character by character, so 10 comes before 2 because 1 comes before 2. Numeric mode reads the leading number of each line, so 2 comes before 10. Use numeric mode for numbered lists.
Is sorting case-sensitive?
By default sorting ignores case, so apple and Apple are treated the same. Turn off Ignore case to sort case-sensitively.
Can I remove duplicate lines while sorting?
Yes. Turn on Remove duplicate lines and exact duplicates are dropped before sorting. Matching is case-sensitive, so Apple and apple count as different lines.
What happens to empty lines?
Empty lines are kept and sort like any other line: first in ascending order because they are the shortest and have nothing to compare. Delete them from the input if you do not want them in the output.
Is my text uploaded anywhere?
No. Sorting runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.