Practical guidesLists & tables

Naturally sort a list of filenames or versions.

Sort a pasted list so that item 2 comes before item 10. Keep or drop duplicates, and understand how letter case and punctuation affect the order.

Open the text cleanup

Paste the list and choose a natural sort

Open Text cleanup, paste one item per line, and set Sort lines to A → Z (natural). This uses English numeric sorting: the number 2 is placed before 10, rather than the plain text order in which item 10 would come first.

Z → A (natural) uses the same numeric comparison in reverse. Keep original order leaves the lines unsorted, which is the right choice when you only want to remove duplicates.

Example input

  item 10
item 2

item 2
 item 1 

Check the other options before you copy

Trim whitespace, Remove blank lines and Remove duplicates are on by default. With those defaults, the sample becomes a unique, trimmed list in natural order. Turn off Remove duplicates if a repeated filename should appear more than once; the repeated lines will sit next to each other after the sort.

Trimming runs before sorting, so accidental spaces do not push a line into a surprising place. A prefix or suffix is applied after the sort, to every remaining line.

Example result

item 1
item 2
item 10

Punctuation and letter case still matter

Numeric sorting applies to digits inside the line. Other characters are still compared normally, so a folder prefix such as archive/ is sorted by that prefix, not by the filename after the slash. Letter case remains significant: report-2.pdf and Report-2.pdf are different lines and will not be merged unless they match exactly after trimming.

This is convenient for lists of filenames, issue numbers or versioned labels. It is not a file-system sort, and it does not follow every locale's rules.

Example input

report-10.pdf
report-2.pdf
Report-2.pdf
archive/report-2.pdf

Example result

archive/report-2.pdf
report-2.pdf
Report-2.pdf
report-10.pdf

Sort as a second step if you need to

If you have already removed duplicates or blank lines and want to sort the cleaned list, press Apply to input, then change Sort lines. Undo restores the text from before the last apply.

To compare two sorted or unsorted lists for missing items, use Compare two lists. The duplicate-lines guide covers keeping the original order. Processing stays in your browser.

Open the text cleanup