Sort Lines
100% private — runs on your device, never uploaded. Works offline once loaded.
Paste a list and instantly sort it alphabetically, numerically, by length, or in random order — with options to ignore case, drop duplicates, and trim spaces.
What this sorter does
Sort Lines turns a messy list into an ordered one in a single step. Each line of your input is treated as one item, and the tool reorders those items according to the mode you pick: alphabetical A→Z or Z→A, numeric low→high or high→low, by line length, or a true random shuffle.
Alphabetical sorting uses locale-aware comparison, so accented characters and mixed scripts order sensibly rather than by raw byte value. The case-insensitive option folds upper- and lowercase together, which is what most people expect when alphabetising names or tags.
Numeric and length sorting
Plain alphabetical sorting places '10' before '2' because it compares character by character. Numeric mode fixes this by reading the first number in each line — including negatives and decimals — and ordering by its actual value. This is ideal for version lists, quantities, prices, or any line that starts with or contains a figure.
Sorting by length arranges lines from shortest to longest (or the reverse), with ties broken alphabetically so the result is stable and predictable. It is handy for spotting outliers, grouping short codes, or tidying up keyword lists.
Cleaning options
Three toggles let you clean while you sort so you rarely need a second pass:
- Case-insensitive — ignores capitalisation when comparing and de-duplicating.
- Remove duplicates — keeps only the first occurrence of each line.
- Trim whitespace — strips leading and trailing spaces and tabs from every line before sorting.
Tips for clean lists
Enable 'trim whitespace' when copying from PDFs or spreadsheets, where invisible trailing spaces can push lines out of order or hide duplicates. Turn on 'remove duplicates' together with case-insensitive to collapse near-identical entries like tags and email addresses.
The randomize mode uses your browser's cryptographic random generator for an unbiased Fisher–Yates shuffle, which is useful for drawing names, randomising quiz questions, or creating sample orderings. The line counters above the output confirm how many items you started with and how many remain after de-duplication.
Frequently asked questions
How are blank lines handled?
Blank lines are treated as empty items. With alphabetical sorting they group at the top; enable 'remove duplicates' to collapse repeated blanks into one, or 'trim' to normalise whitespace-only lines.
What counts as a 'number' in numeric mode?
The tool scans each line for the first numeric token — an optional minus sign, digits, and an optional decimal part — and sorts by that value. Lines with no number are treated as zero.
Does removing duplicates change the sort order?
No. Duplicates are removed first, keeping the earliest occurrence, and the remaining unique lines are then sorted by your chosen mode.
Is the shuffle truly random?
Yes. It uses crypto.getRandomValues with a Fisher–Yates algorithm, giving every ordering an equal chance rather than the biased results of a naive shuffle.
Can I sort a very long list?
Yes. Everything runs locally in your browser, so lists of many thousands of lines sort almost instantly without any upload or size limit imposed by a server.
Will it keep my original capitalisation?
Yes. Case-insensitive only affects how lines are compared — the output preserves the exact text of each line as you entered it.
Advertisement