Sort Lines
Paste a list and choose a sorting method: alphabetical A→Z, reverse Z→A, shortest-first by line length, or longest-first. The tool sorts instantly and lets you copy the result with one click. Useful for organizing glossaries, keyword lists, CSV columns, or code arrays.
Related Tools
[2 suggestions]About the Sort Lines
The Sort Lines tool splits your input on newline characters and applies one of four sorting algorithms. Alphabetical A→Z uses JavaScript's localeCompare, which is locale-aware: it handles accented characters correctly ("café" sorts near "cafe", not after "z") and treats uppercase and lowercase variants of the same letter as adjacent. Reverse Z→A applies the same comparison in descending order. Length-based sorting counts the number of characters in each line and arranges them from shortest to longest (or vice versa), with lines of equal length sub-sorted alphabetically for deterministic output. Blank lines are not filtered out — they sort as zero-length strings and appear at the top in shortest-first mode. Typical uses include alphabetizing glossary terms, organizing CSS property declarations, sorting package dependency lists, and reordering data exported from spreadsheets.
Is the sort case-sensitive?▾
Lines are sorted using locale-aware comparison (localeCompare), which prioritizes alphabetical correctness regardless of capitalization. "apple" and "Apple" sort together.
Can I sort by line length?▾
Yes — choose "Shortest First" or "Longest First" to arrange lines by character count. Lines of equal length are sub-sorted alphabetically.
What happens with blank lines?▾
Blank lines are sorted like any other line. In alphabetical mode, they appear at the top. In length mode, they appear first (shortest) or last (longest).