Sort lines

Paste a list and put it in order, the way a person would expect, not the way ASCII does.

Tier 0 · browser · unlimited
48 characters
Sorted lines
appendix
chapter 1
chapter 10
Chapter 2
Épilogue

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 to E.
  • Natural also reads numbers inside text as numbers, so chapter 2 comes before chapter 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

Reviewed Oct 17, 2026 · test vectors fixtures/tools/text/sort-lines/