Sorting that matches expectations
Simple sorting compares characters by their code numbers, which gives odd results: Zebra before apple (capitals come first), Éclair after zebra (accented letters come after z), and file10 before file2 (character by character, 1 is smaller than 2). This tool sorts the way people read:
- Alphabetical uses your language's collation rules, ignoring case by default and placing
Énext toE. - Natural also reads numbers inside text as numbers, so
chapter 2comes beforechapter 10. - Numeric sorts by the first number in each line, useful for prices, scores or versions.
- Length sorts by the number of characters.
Worked example
file10, file2, File1 in natural order is File1, file2, file10. Alphabetically it would be file10, File1, file2.
How this works
Alphabetical and natural orders use Intl.Collator, the browser's implementation of the Unicode Collation Algorithm with locale data, in the page's language; natural order enables numeric comparison of digit runs. Numeric order extracts the first number from each line and compares values. Length order counts visible characters. Ties are broken alphabetically, and you can reverse any order or drop empty lines. Everything runs in your browser.
Frequently asked
What is natural sort order?
Numbers inside text are compared as numbers: img2 comes before img10.
Why are capitals mixed with lowercase?
Sorting ignores case by default, as a dictionary does. Turn off Ignore case to compare case.
How are lines without numbers handled in numeric mode?
They go to the end, sorted alphabetically.
Is my list uploaded?
No. Sorting runs in your browser.
Sources
- The Unicode Standard, latest version
- ECMA-262 — ECMAScript Language Specification
- Wikipedia — Natural sort order
Reviewed Oct 17, 2026 · test vectors fixtures/tools/text/sort-lines/