Sort Lines: Alphabetical, Numeric or Shuffle

Paste one item per line, pick a mode and click Sort. Empty lines are removed; duplicate lines are kept.

Sort:
Case:
Trim:
Paste your lines and click Sort to reorder them.

Runs in your browser: your files and text are not uploaded. Free, no account needed.

Last updated: · Reviewed by the QuickTooly Team

Sort Lines Guide

How each mode orders lines

  • A→Z and Z→A use localeCompare, which gives dictionary order. Ignore (default) lowercases lines before comparing, so Apple and apple tie and keep their input order. Exact still uses dictionary order rather than putting all capitals first; it only breaks ties, placing apple before Apple.
  • Digits in text are compared one character at a time, so item10 sorts before item2.
  • Numeric reads the number at the start of each line with parseFloat: -3, 1.5, 10. Commas between digits are dropped first, so 1,000 counts as 1000; a decimal comma such as 3,5 is read the same way, as 35. Reading stops at the first other character that is not part of a number. Lines that do not start with a number, such as $5 or apple, go after all the numbers in their original order. The Case option is hidden in this mode because it does not apply.
  • Shuffle uses the Fisher–Yates algorithm with Math.random(). Each click gives a new order. Editing the list does not reshuffle it, so click Sort again after changes.

Sorting questions

Why does 10 sort before 2?

A→Z compares lines as text, character by character, and "1" comes before "2". Switch to Numeric to sort by value.

Is the shuffle fair enough for a prize draw?

Fisher–Yates gives every order the same chance, but it draws from Math.random(), which is not a cryptographic generator, and the result is not recorded anywhere. For a draw with money or legal stakes, use a method you can document.

Related text tools