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 in your browser — your input is not uploaded to ToolsNow.

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 will not reshuffle under you while you type.

Can I sort and deduplicate at once?

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

Examples and checks

Each line is one item. Choose natural sorting for numbered filenames, alphabetical sorting for words, and numeric data tools when a column needs calculations rather than ordering.

Order numbered files

Input or situation
file10 file2 file1
Result
file1 file2 file10

Natural order reads the digit sequences as numbers. Ordinary A–Z ordering puts file10 before file2.

Before you use the result

Published by ToolsNow. How tools and sources are checked · Report a problem

Related tools