Sort Lines
Sort lines alphabetically, reverse, or deduplicate — instantly in your browser.
Three sort modes
"A → Z" sorts lines ascending using locale-aware comparison (localeCompare). "Z → A" sorts descending with the same comparator. "Unique" deduplicates lines (case-sensitive, exact match) and then sorts ascending — it removes duplicate lines but does not sort within groups of duplicates before removal.
| Mode | Input | Output |
|---|---|---|
| A → Z | banana apple cherry | apple banana cherry |
| Z → A | banana apple cherry | cherry banana apple |
| Unique | apple banana apple cherry | apple banana cherry |
| A → Z | Banana apple | apple Banana (locale-dependent) |
Warning: The sort is case-sensitive by default in JavaScript's localeCompare. Depending on the system locale, "Banana" may sort before or after "apple". If you need case-insensitive sorting, convert all lines to lowercase first.
Empty lines and whitespace
Empty lines are not filtered out before sorting — they participate in the sort as empty strings and typically sort to the top in ascending order. The Unique mode removes duplicate empty lines. If you want to remove empty lines entirely before sorting, use the Remove Empty Lines tool first.
Frequently Asked Questions
Your files stay on your computer. Dad promised.