Sort Lines
Sort lines alphabetically.
About this tool
Paste a list with one item per line and press Run to sort the lines A to Z. Numbers are sorted as text, not by value.
How to use
How it works
Lines are compared with the browser's locale-aware string comparison, so accented letters sit beside their base letters and capitals do not all come before lowercase. Because the comparison is textual, 10 sorts before 2. Sorting is ascending only.
Worked example
A mixed list
- Input
- banana Apple cherry 10 2 banana
- Output
- 10 2 Apple banana banana cherry
- Walkthrough
- Digits sort before letters, 10 before 2 as text, and Apple lands before banana because case is not the first key.
Limitations
- Ascending only; use Reverse Lines afterwards for Z to A.
- No natural or numeric sort.
- Duplicates are kept.
Questions
How do I sort lines alphabetically?
Why is 10 before 2?
Can I sort Z to A?
Does it remove duplicates?
Features
- Locale-aware A to Z
- Keeps duplicates
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Regular Expressions in 100 Seconds
Fireship
Fast regex refresher for text extraction patterns.
Watch on YouTubeLearn Regular Expressions - Crash Course
freeCodeCamp.org
Regex powers many find/replace and clean-text workflows.
Watch on YouTube
- String
MDN
JS string methods that mirror case, trim, and split tools.
- UTF-8 and BOM
W3C
Encoding gotchas when cleaning pasted text.