Sort Lines
Sort lines alphabetically — A→Z by default, Z→A on second click. Case-insensitive comparison. Works on any line-separated text.
banana
apple
cherry → apple
banana
cherry
Sort lines alphabetically — A→Z by default, Z→A on second click. Case-insensitive comparison. Works on any line-separated text.
banana
apple
cherry → apple
banana
cherry
Sorts lines alphabetically using locale-aware comparison — accented letters cluster correctly with their unaccented forms, and embedded numbers sort numerically ("file2" before "file10"), not as raw strings. Default order is A→Z.
Useful for organising any line-separated list — names, email addresses, URLs, words, file names, log entries.
Member rosters, contact lists, attendee names — sort once, paste back into your document.
Group related domains together by paste-and-sort. The locale-aware comparison handles country TLDs sensibly.
Variable names, function names, file paths — natural sort handles "item1, item2, item10" correctly.
Run forwards then reverse the lines (using Reverse Line Order) for Z→A.
Build an index of terms by pasting your draft and sorting; spot duplicates and gaps immediately.
The tool splits input text into an array using split(/\r?\n/) to handle both CRLF (Windows) and LF (Unix) line endings. Each line is then compared using JavaScript's Intl.Collator with sensitivity 'base' — this makes comparisons locale-aware so accented characters (e.g., é vs e) cluster correctly. Embedded numbers are parsed via a custom natural-sort algorithm that extracts numeric substrings and compares them numerically, so file2 comes before file10. The sorted array is joined back with \n (LF). For descending order, the comparator is reversed.
sort -k style but this tool sorts whole lines; pre-process to align fields.Compare this tool with two common alternatives for sorting lines: the Unix sort command and Excel's sort feature.
| This tool | sort(1) (Unix) | Excel Sort | |
|---|---|---|---|
| Platform | Web browser (any OS) | Unix/Linux/macOS terminal | Windows/macOS (requires Excel) |
| Locale-aware | Yes (Intl.Collator) | Needs locale flag (-l) or LC_ALL | Yes, but manual configuration |
| Natural sort of numbers | Built-in | Via -V (version sort) | Not built-in; requires workarounds |
The concept of sorting lines alphabetically originates from the Unix sort utility (1971, Bell Labs) which used a merge sort on line-based text. The natural-sort extension was popularized by Mac OS X Finder's file sorting and later by libraries like natsort. This web tool brings that functionality to the browser without a terminal or external software.
No — case-insensitive by default. "Apple" and "apple" are sorted as equal. For case-sensitive sorting, paste through a locale-aware sort in your terminal.
Naturally — "item2" comes before "item10". Pure-string sort would put "item10" first because '1' < '2'; we use locale-aware natural sort to match human expectations.
Run sort, then run the result through Reverse Line Order. Two clicks total.
Yes — the JavaScript locale-aware comparator uses your browser's collation rules. "café" sorts near "cafe", "über" near "uber".