About the Sort Lines
A → Z sorts using the Unicode Collation Algorithm through Intl.Collator, so accented letters sort next to their base letters (é with e) instead of after z as a plain code-point sort would. Natural additionally compares digit runs as numbers, so file2.txt comes before file10.txt and item 9 before item 100.
Length orders lines from shortest to longest, with ties sorted alphabetically. Reverse order flips the list without sorting. Descending inverts the sort. Ignore case makes apple and Apple sort together; Unique only removes duplicates first.
Shuffle uses the Fisher–Yates algorithm with crypto.getRandomValues() and rejection sampling, so every order is equally likely. That is fair enough for picking raffle winners or randomising test order. Math.random() with sort() is biased. All processing is local.
Example: file10.txt, file2.txt, File1.txt sorted A → Z gives File1.txt, file10.txt, file2.txt, while Natural gives File1.txt, file2.txt, file10.txt.
How to use it
- Paste the lines to sort.
- Pick A → Z, Natural, Length, Reverse or Shuffle.
- Set descending, ignore case and unique options.
- Copy or download the sorted list.