Sorting a list sounds like a solved problem, but the "obvious" way a computer sorts text isn't always the way a human expects numbers or randomness to behave โ€” and both mismatches trip people up in predictable ways.

Why "10" Sorts Before "2" Alphabetically

A standard alphabetical (lexicographic) sort compares text character by character, left to right โ€” it has no concept of a "number" at all. "10" and "2" are compared by their first character, "1" versus "2", and since "1" comes before "2" in character order, "10" sorts before "2" even though 10 is numerically larger. This is exactly the same reason "Item 10" sorts before "Item 2" in a plain alphabetical sort of a numbered list.

How Numeric Sort Actually Works

A numeric sort fixes this by extracting the first number it finds at the start of each line and comparing those numbers directly, instead of comparing the raw text. A line like "12 apples" gets treated as the number 12; "3. Item three" gets treated as the number 3. Lines with no leading number at all are treated as the lowest possible value, so they consistently sort to the top rather than landing somewhere unpredictable in the middle.

Tip: If your list mixes numbered and unnumbered lines and you want the unnumbered ones at the bottom instead of the top, reverse the result after a numeric sort โ€” reversing puts the lowest-value (unnumbered) lines last.

True Randomness vs. Fake Shuffling

Not every "shuffle" function produces a fair, unbiased ordering. A naive approach โ€” like sorting a list with a random comparator โ€” is a well-known source of statistically biased results, where some orderings end up far more likely than others. The Fisher-Yates shuffle algorithm avoids this by working through the list once, from the end backward, swapping each item with a randomly chosen item from the remaining unshuffled portion. Done correctly, every possible ordering of the list becomes equally likely โ€” genuine randomness, not just an unpredictable-looking result.

Case Sensitivity in Deduplication

When removing duplicate lines, "Apple" and "apple" are technically different strings, so a case-sensitive comparison treats them as two separate lines even though a human would read them as the same word. An "ignore case" option normalizes both to the same case before comparing, so it correctly catches duplicates that only differ in capitalization โ€” keeping the first occurrence it encounters and discarding the rest.

Sorting a List Instantly

Paste in your list and sort alphabetically, by length, or numerically, shuffle it with a true Fisher-Yates random order, or strip duplicates and blank lines with our free Line Sorter & Randomizer. Need to change specific words across the same list instead of reordering it? Try the Find and Replace Text Tool.

FAQ

How does the numeric sort work if my lines aren't all numbers? Lines are compared by the first number found at the start of each line; lines with no leading number are treated as the lowest value and sorted to the top. This is useful for lists like "12 apples" or "3. Item three" where you want numeric rather than alphabetical order (which would otherwise put "10" before "2").

How is shuffling actually randomized? It uses the Fisher-Yates shuffle algorithm, which produces a genuinely uniform random permutation, powered by the Web Crypto API's crypto.getRandomValues() rather than Math.random() for better randomness quality.

Is removing duplicates case-sensitive? By default yes โ€” "Apple" and "apple" are treated as different lines. Turn on "Ignore case" to treat them as duplicates regardless of capitalization, keeping only the first occurrence.

Is my text sent anywhere when I use a line sorter? No โ€” all sorting, shuffling, and de-duplication happens entirely in your browser using JavaScript, so your text is never sent to a server.

Have a list to sort or shuffle? Try the free Line Sorter & Randomizer โ€” no sign-up.