How to sort a list
- Paste your list into the box above, one item per line.
- Choose how to sort, natural order handles most lists correctly.
- Pick ascending or descending, and decide whether capitalisation should matter.
- Tick Remove duplicates if the list should also be deduplicated.
- Copy the sorted result, or download it as a text file.
What this sorter offers
- Natural ordering, so file2 comes before file10 rather than after it.
- Strict alphabetical comparison when you need exact character order.
- Sorting by line length, shortest or longest first.
- A genuine random shuffle for drawing names or randomising test data.
- Optional deduplication, trimming and blank-line removal in the same pass.
- Locale-aware comparison, which handles accented characters correctly.
Why sorting is not as simple as it looks
Ask most software to sort a list and it compares strings character by character using their underlying numeric codes. That works for plain words and produces obviously wrong results as soon as numbers are involved. Strict comparison puts item10 before item2, because the character "1" comes before "2". The fact that ten is larger than two never enters into it.
Natural sorting is the fix. It recognises runs of digits inside a string and compares them as numbers, so a list of files, chapters, versions or invoice references comes out in the order a person would put it. That is the default here, because it is what people almost always mean.
The four modes
- Natural: the sensible default. Handles embedded numbers as numbers.
- Strict A. Z: exact character comparison, for when you need to match another system's ordering precisely.
- Length: shortest to longest, useful for finding outliers and for arranging keyword lists.
- Random: a proper Fisher. Yates shuffle, not a sort with a random comparator, which is subtly biased.
Case and accents
By default capitalisation is ignored, so "apple" and "Apple" sit together rather than in separate blocks. That is almost always what you want for a human-readable list. Turn it off when you need capital letters grouped separately, which is the convention in some programming contexts.
Comparison uses your browser's locale rules rather than raw character codes, which means accented letters sort next to their base letters, "éclair" lands near "eclair" rather than after "z", where a naive byte comparison would put it. That matters for any list containing names.
Why random is done properly
A common trick for shuffling is to sort with a comparator that returns a random value. It looks right and is measurably biased: some orderings come up far more often than others, because sorting algorithms assume a consistent comparator and this one is not.
This tool uses the Fisher. Yates shuffle, which produces every possible ordering with equal probability. If you are drawing names, allocating participants to groups or randomising test data, that difference is worth having. Note that it uses the browser's standard random number generator, which is fine for these purposes but is not cryptographically secure, for anything where fairness must be provable, use a dedicated method.
Sorting alongside the other cleanups
Trimming and blank-line removal are on by default because unsorted list data almost always contains both, and an untrimmed line sorts by its leading space rather than its content. Deduplication is off by default, since removing entries is destructive, turn it on deliberately.
For deduplication with more control over which copy survives, the duplicate line remover is the better tool. To check what you ended up with, the line counter reports the totals. Everything runs in your browser and nothing is uploaded.