Boneyard Tools

Alphabetical order versus natural sort order

Why '10' can land before '2' when you alphabetize, how case and accents factor in, and when you want natural sorting instead.

What alphabetical order really means

Alphabetical, or lexicographic, order compares items one character at a time from the left, just like finding a word in a dictionary. The first position where two items differ decides which comes first. This is exactly how this tool orders your list, and it is what most people expect for words. The surprises appear when items are not plain words, because the same left-to-right rule then produces results that feel counterintuitive.

Why 10 can come before 2

When numbers are treated as text, they are compared character by character rather than by value. The item '10' starts with '1', and '1' sorts before the '2' that begins '2', so '10' lands first even though ten is larger than two. This is correct alphabetical behavior, not a bug. If you need file2 before file10, you want natural sort order, which reads runs of digits as whole numbers and compares them numerically.

Case and accents in the mix

By default many sorts place all capital letters ahead of lowercase ones, so 'Zebra' can appear before 'apple'. Turning on case folding removes that split and orders words the way a reader expects. Accented characters raise a similar question: a naive sort might exile e with an accent to the very end, while the locale-aware comparison this tool uses keeps it beside the plain e. Both behaviors come down to whether the comparison respects human language rules or raw character codes.

Choosing the right order for the job

Reach for plain alphabetical order when you are tidying names, tags, glossary terms or any list of words, which covers most everyday needs. Reach for natural order when your items are file names, version numbers or anything where embedded numbers should count by value. Knowing which you want in advance saves you from re-sorting, and it explains why the same list can look ordered in two perfectly valid ways.

Frequently asked questions

How do I get file2 before file10?

That requires natural sort order, which compares embedded numbers by value. This tool sorts alphabetically, so pad the numbers (file02, file10) if you need them to line up here.

Why did uppercase words sort first?

Without case folding, capital letters can rank ahead of lowercase ones. Turn on 'Ignore case' to sort them together.