Sort Lines
Alphabetical sorting.
Loading tool…
Sorting text, and why order is not obvious
Sorting a list of lines seems trivial until the details bite. Plain alphabetical sorting compares character codes, which puts all uppercase letters before all lowercase ones, so Zebra lands before apple unless the comparison is case-insensitive. Numbers sorted as text order by their first digit, putting 10 before 2 — natural sorting fixes this by comparing numeric runs as values.
Language adds more. Accented characters, Arabic script, and German umlauts each have locale-specific collation rules that a naive byte comparison ignores. Beyond ordering, the useful companions are reversing, removing duplicates, and shuffling — all operations on the same list, and all far quicker here than setting up a spreadsheet formula.
Why we built this tool
The common jobs are tidying a list of names, ordering imports or dependencies, alphabetising a glossary, sorting log lines, or preparing a list for comparison against another one — since two sorted lists diff cleanly and two unsorted lists do not.
Those lists are frequently email addresses, customer names, hostnames, or internal identifiers. Pasting them into an online sorter is a data transfer performed for the sake of an operation your browser can do in a millisecond. Ours sorts locally in JavaScript with no request made, no storage, and no line limit. It also works offline, which is worth something for a tool you use reflexively.
Tips and common mistakes
- Turn off case sensitivity for names and words, or every capitalised entry sorts before the lowercase ones.
- Use natural sorting for lists beginning with numbers, otherwise 10 comes before 2.
- Trailing whitespace changes sort position invisibly — clean the list first.
- Sorting both of two lists makes them far easier to compare afterwards.
Open Sort Lines with a link
Sort Lines can be handed its input by the link that opens it, so the page arrives with the work already done. This is meant for assistants and scripts: if a chatbot, an editor extension, or a command-line agent already holds your content, it can build a link instead of asking you to copy and paste into a box.
The payload rides in the fragment — the part of a URL after the #. Browsers never send the fragment to a server, so anything handed over this way stays on your device exactly as a dropped file would. A link that uses the query string instead is rewritten into the fragment by the page before any analytics or ad script can read the address.
Prefix any field with gz — #gztext= — to pass it as gzip-compressed base64url, which fits roughly five to ten times more into the same link. Links stay reliable up to about 8,000 characters; past that, chat apps and address bars start truncating them, and the page says so rather than loading half a document.
One exception to the privacy rule: ?url= tells the page to download the input from an address. That request goes from your browser straight to that server — not through ours — but it does leave your device, and it only works if the server allows cross-origin requests.
#text=— the text to work on
Example: https://mygadgets.ink/tools/sort-lines/#text=...
Quick start: using Sort Lines
- Paste your list into the input above, one item per line.
- Choose ascending or descending order.
- Set case sensitivity — usually you want it off for names and words.
- Enable numeric or natural sorting if the lines start with numbers.
- Copy the sorted result.
Clean the list first with Remove Duplicate Lines, then compare two versions using Diff Checker.