Skip to content
ToolsNow
Guides All tools
Text

Sort lines alphabetically, by length or naturally

Sort any list alphabetically, by length, in natural order or at random. Natural order is the one you usually want for filenames — it puts file2 before file10.

Runs entirely in your browser — nothing is uploaded.

Your list
0 chars0 words0 lines
Sorted lines
0 chars0 words0 lines

How to use

  1. Paste your list. One item per line.
  2. Choose a sort order. A–Z, Z–A, natural, by length, reversed, or shuffled.
  3. Refine if needed. Optionally ignore case, keep blank lines, or remove duplicates at the same time.

Questions

What is natural sort order?

It reads runs of digits as numbers rather than text, so file2 comes before file10. Plain alphabetical sorting puts file10 first because "1" sorts before "2" character by character.

How does sorting handle accented characters?

It uses your browser’s locale-aware collation, so é sorts next to e rather than after z. That matches how a dictionary in most European languages orders words.

Is the shuffle properly random?

It uses a Fisher–Yates shuffle, which gives every ordering an equal chance. Press "Shuffle again" for a fresh order — it deliberately does not reshuffle while you type.

Can I sort and deduplicate at once?

Yes. Tick "Also remove duplicates" and the list is deduplicated before sorting.

Related tools