Skip to content

Line Sorter & Shuffler

Sorts lines alphabetically, numerically, by length or randomly, with reverse and case options.

Sorts a list of lines, with the collation stated rather than assumed: natural order for anything with numbers in it, 가나다 for Korean, a named locale, raw code points, length, or a genuine shuffle. Each of those gives a different answer to the same list.

🔒 Runs entirely in your browsersortlinesshuffle

Lines

Order

Mode

Digit runs compare as numbers, so file9 comes before file10.

Sorted

Lines

6

How to use it

  1. Pick the mode before anything else

    Natural for filenames and versions, 가나다 for Korean names, code point only when you specifically want the machine order that Array.sort gives.

  2. Set the direction and case rule

    Case-insensitive is the default because a list of names is rarely meant to put every capital before every lower-case letter, which is what a case-sensitive sort does.

  3. Shuffle when you need randomness

    The shuffle is a Fisher–Yates pass, not a random comparator. A random comparator is the classic wrong way to shuffle: it is biased, and different engines give different distributions.

Common questions

Why is file10 before file9?

That is code-point order — "1" sorts before "9" one character at a time. Switch to natural order, which compares digit runs as numbers, and file9 comes first.

My Korean list sorts oddly

Two causes. Text copied from a Mac is stored decomposed and sorts before every precomposed syllable, and code-point order puts Latin before Hangul where Korean convention puts it after. The 가나다 mode fixes both.

What does the locale mode do differently?

It uses that language’s own collation table — Swedish puts å after z, German has two conventions for ä, Czech treats ch as one letter. If none of that applies to your list, natural order is the better default.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.