EN

Text Sorter

Sort lines ascending/descending with natural number sort

FAQ

How is natural sort different?

Plain sort compares character by character, so item10 comes before item2. Natural sort treats digit runs as numbers, putting item2 first as a human would expect.

Does sorting also deduplicate?

No. Sorting only reorders; use the dedupe tool for that.

Can it ignore case?

Yes, case stops affecting order while the original casing is preserved in the output.

About this tool

The four modes differ in what they compare: ascending / descending compare character by character (UTF-16 code units), while natural ascending / natural descending split each line into alternating runs of digits and non-digits and compare digit runs numerically — so item2 sorts before item10 and v1.9 before v1.10, the exact opposite of plain sorting.

Comparing by code unit has two consequences worth knowing: uppercase letters sort before lowercase (A is 65, a is 97), so Apple lands before apple unless you enable "ignore case"; and CJK text sorts by Unicode code point, which is neither pinyin nor stroke order. For pinyin ordering, romanise first — this page does not do it.

The sort key is the trimmed line and the output uses that same trimmed form, so leading and trailing spaces disappear. Skip blank lines is on by default: empty lines take no part in sorting and are absent from the result. Clear the checkbox and empty lines become empty strings, which pile up at the top in ascending order.

Sorting is stable, so lines with an equal key (for instance lines differing only in case when case is ignored) keep their relative order instead of being shuffled. Inner spaces and tabs are not collapsed; the whole line as written is compared. This tool reorders but does not deduplicate — duplicates survive, so deduplicate first and sort second for a clean unique list.