HandyBench

Sort Lines

Alphabetize, number-sort, reverse or shuffle lines.

How to use the Sort Lines

  1. 1 Paste your list with one item per line.
  2. 2 Pick a sort: A→Z, Z→A, Numeric, Reverse or Shuffle.
  3. 3 Optionally remove duplicates, blank lines or trim whitespace, then copy the result.

The order of operations

When you click a sort button, the tool first prepares the list and then sorts it. The preparation steps are controlled by the four checkboxes and run in this sequence: trim each line, drop empty lines, then remove duplicates. Sorting comes last, which is why a deduplicated list is also tidied before the order is applied.

ButtonBehaviour
A to Z / Z to ANatural, locale-aware sort. Digit runs compare by value, so item 2 comes before item 10. Z to A is the A to Z result reversed.
Numeric up / downReads the first number found in each line (a minus sign, a decimal part and thousands separators such as 1,200 are allowed) and orders by it. Lines with no number go to the bottom, sorted alphabetically.
ReverseFlips the current order without sorting anything.
ShuffleRandom order using a Fisher-Yates shuffle. Click Shuffle again for a new arrangement; the order stays put while you change other options.

Worked example

Take seven lines: item 10, item 2, Banana, apple, Cherry, file 1,200 and price 3.5.

  • A to Z (ignore case on): apple, Banana, Cherry, file 1,200, item 2, item 10, price 3.5.
  • Numeric up: item 2, price 3.5, item 10, file 1,200 (read as 1200), then apple, Banana and Cherry at the bottom.

Thousands separators are understood, so 1,200 sorts as 1200. Only the first number in a line counts, and a comma-separated list such as 1,2,3 is read as 1, because a thousands group needs exactly three digits after the comma. European-style numbers such as 1.200,5 are not parsed as 1200.5.

Subtle behaviours

  • Ignore case also ignores accents. With the option on (the default) the comparison is accent-insensitive as well, so résumé, resume and Resume are treated as equal and keep their input order relative to each other. Turn it off to distinguish them, and note that the locale then usually places lowercase before uppercase for the same letter.
  • Ignore case does not dedupe by itself. It only affects the comparison and, if "Remove duplicates" is ticked, what counts as a duplicate.
  • Shuffle is not cryptographic. It uses a small seeded generator, with a fresh random seed picked on every Shuffle click, which is fine for ordering a draw or a presentation list but not for anything security related. Toggling options while Shuffle is active keeps the same seed, so the order does not jump around; click Shuffle again to reshuffle.
  • Use as input copies the result back into the box so you can chain operations, such as sorting then deduplicating.

For a dedicated cleanup pass, see Remove Duplicate Lines, and use Add Line Numbers to number the sorted result. For choosing a single winner from a list, the random picker is more direct.

Examples

  • ▸ Alphabetizing a list of names or keywords.
  • ▸ Sorting numbers or randomly shuffling a list for a draw.

Frequently asked questions

How does numeric sorting handle text mixed with numbers?

Numeric sort reads the first number it finds in each line (negative and decimal numbers work) and orders by that value. Lines without a number fall to the bottom, sorted alphabetically among themselves. Thousands separators are understood, so "1,200" is read as 1200.

Can it sort while ignoring upper and lowercase?

Yes. With "Ignore case" enabled, "Apple" and "apple" sort together instead of all capitalized words coming first. The comparison also ignores accents in this mode, so "resume" and "résumé" are treated as equal.

Does shuffle give a truly random order?

It uses a Fisher–Yates shuffle, which gives every ordering an equal chance, driven by the browser's standard random number generator. That is fine for draws and playlists but not meant for security uses. Click Shuffle again for a fresh arrangement; changing other options such as "Trim lines" keeps the current order instead of reshuffling.

Why does "item 2" come before "item 10" in A to Z?

The alphabetical sort compares runs of digits by their numeric value, which is often called natural sorting. A plain character-by-character sort would put "item 10" first because "1" comes before "2".

What is the difference between Z to A and Reverse?

Z to A sorts the lines and then flips them. Reverse does not sort at all; it simply turns your existing list upside down, which is useful for putting a chronological list newest-first.