Sort Lines

Sort any list alphabetically, numerically, by length or randomly — with natural number ordering and optional dedupe.

🔒 100% private — files are processed on your device and never uploaded to any server.

Order from pasted chaos

Alphabetising a name list, ranking measurements numerically, arranging keywords by length for a layout, shuffling a list for a fair draw — sorting is the most universal list operation, and spreadsheets are a heavyweight detour for what should take three seconds. Paste lines here, pick an order, copy the result. Five modes cover the real-world cases, including the two spreadsheet classics done right: natural number ordering and honest randomisation.

How to sort

  1. Paste your list, one item per line (blank lines are dropped automatically).
  2. Choose the order: A→Z, Z→A, numeric, by length, or random shuffle.
  3. Optionally tick Remove duplicates for a sort-and-clean in one pass.
  4. Click Sort lines, then copy the result.

The five modes, and when each earns its keep

A→Z / Z→A use locale-aware, case-insensitive comparison with natural number handling — meaning item2 sorts before item10 (naive ASCII sorts embarrass themselves with 1, 10, 2). Accented characters order sensibly, names and keywords behave as a human librarian would file them. Numeric reads the leading number of each line and sorts by value — built for measurement lists, prices, rankings; lines without numbers sink together. By length orders shortest-first — surprisingly useful for keyword grouping, UI copy candidates, and finding the outliers in any list. Random shuffle uses a proper Fisher–Yates shuffle, the algorithm that gives every ordering equal probability — fair for prize draws, presentation orders and quiz questions, unlike the “sort by random number” spreadsheet hack's subtle biases.

Sort + dedupe: the one-two punch

The duplicates checkbox removes exact repeats before sorting — the standard hygiene step when consolidating lists from several sources. (For case-insensitive or whitespace-tolerant deduplication, run our dedicated Remove Duplicate Lines tool first, then sort here; the two tools chain naturally.)

Field notes

  • Sorting is whole-line: “Smith, John” sorts under S — format your list as “surname, name” first if that's the order you need.
  • Mixed content: in A→Z mode, lines starting with numbers group before letters; that's filing convention, not a bug.
  • Re-shuffle freely: every click of Sort in random mode deals a fresh ordering.
  • Big lists welcome: tens of thousands of lines sort instantly, locally.

Paste, click, copy — and the list is suddenly the version you'd actually show someone.

Quick reference

PropertyDetail
ModesA→Z, Z→A, numeric, by length, random shuffle
Number handlingNatural order — item2 before item10
ComparisonLocale-aware, case-insensitive, accent-sensible
ShuffleFisher–Yates — statistically fair
Dedupe optionExact duplicates removed before sorting
Blank linesDropped automatically
Processing100% in-browser, no upload

Frequently asked questions

Why does my spreadsheet sort 1, 10, 2 but this tool sorts 1, 2, 10?

This tool uses natural ordering, which compares embedded numbers by value rather than character-by-character. It's the order humans expect for versions, file names and numbered items — file2 before file10.

How do I sort people by surname?

Sorting is whole-line, so reformat entries as “Surname, Firstname” first (a spreadsheet or Find & Replace can swap them). Then A→Z files everyone under the surname, the librarian way.

Is the random shuffle fair enough for a giveaway?

Yes — it's a Fisher–Yates shuffle, giving every possible ordering equal probability. Shuffle once and take the top name, or shuffle and screenshot the full order; both are defensible draws.

Does numeric mode handle decimals and negative numbers?

Yes — it parses each line's leading number including decimals and minus signs (3.5, -2, 100). Lines without a parseable number are treated as zero and cluster together.