Natural Sort Online

Order filenames and numbered labels the way people read them: file2 before file10. Natural sorting is selected below.

Natural sorting for filenames and numbered labels

Ordinary alphabetical sorting compares digit characters, which can put file10 before file2. Natural sorting compares embedded digit sequences numerically. It is useful for exported filenames, product labels and numbered tasks. Equal comparisons keep their input order, so file2 and file02 are not merged.

Example: input and output

file10.txt
file2.txt
file1.txt
file02.txt
file1.txt
file2.txt
file02.txt
file10.txt

Use Load sample in the tool to try this example.

Rules and limits

This is browser locale-aware text sorting, not semantic version or date parsing. For decimal values, use Numeric. Duplicate removal is off so similarly named files remain separate.

Questions and answers

Does file02 become file2?

No. Sorting preserves the original text. Equivalent natural-sort keys retain their input order.

Does this sort decimal numbers?

Use Numeric for whole decimal or scientific-notation values. Natural mode compares digit runs inside labels.

Is my text uploaded?

No. Processing happens locally in your browser. No account is required. Settings links share options, not your text.