Skip to content
Tools.Town
290+ free online tools

Real-world workflow

Use Case

Sort Versioned Filenames (v2 Before v10)

Natural-sort file names and version strings so item2 comes before item10 — without Excel tricks.

14 August 2026 By Tools.Town Team 5 min read

The problem

Plain alphabetical sort compares text one character at a time, so 1 always sorts before 2, which means file10.txt lands between file1.txt and file2.txt. The result: release folders, screenshot dumps, export batches, and version lists all look scrambled. v10 shows up right after v1, and anyone scanning the list has to mentally re-order it. Spreadsheets do not fix this without a helper column, and shell sort only does it with the -V flag.

Who this is for

Developers ordering build artifacts and tags, QA and design teams sorting numbered screenshots or asset exports, and anyone staring at a folder listing that refuses to count properly.

Before and after

A raw, alphabetically sorted dump:

file1.txt
file10.txt
file2.txt
file21.txt
file3.txt

After a natural sort:

file1.txt
file2.txt
file3.txt
file10.txt
file21.txt

The numbers embedded in the names now order the way a human reads them.

Steps

  1. Paste one filename (or version string) per line into Text Sorter.
  2. Choose the Natural (item2 < item10) mode.
  3. Optionally toggle reverse to get newest-first, or adjust case handling.
  4. Copy the correctly ordered list.

For a column of pure numbers with no surrounding text, use Sort List by Number instead — it is purpose-built for numeric-only data.

How to verify the result

Find two names that differ only by a one-digit vs two-digit number — say v2 and v10 — and confirm the smaller number comes first. Check that the output line count matches the input so nothing was dropped (blank lines are removed by default, which can lower the count by exactly the number of blanks). If 10 still appears right after 1, you are on the default alphabetical mode, not Natural.

Edge cases and common mistakes

  • Mistaking natural sort for semver. Natural sort orders the digit runs it finds; it does not implement semantic-versioning rules. Pre-release tags like -alpha, -beta, or -rc.1 are compared as ordinary text, so 1.0.0-alpha will not necessarily order before 1.0.0 the way semver requires. Use a semver-aware comparator when release precedence must be exact.
  • Mixed separators. v1.2, v1_2, and v1-2 are different strings. Natural sort still counts the numbers, but inconsistent separators can produce surprising ties — normalise them first if ordering looks off.
  • Numbers in multiple positions. A name like 2024-report-v3 has two number runs. Natural sort compares them left to right, so the leading date dominates the ordering. That is usually what you want, but be aware of it.
  • Extensions. img9.png vs img9.PNG may differ by case; use the case toggle if you want them treated the same.

Compared to the usual workarounds

If you have reached for other tools, here is where natural sort fits. A spreadsheet’s default sort is alphabetical, so file10 lands between file1 and file2 unless you build a helper column that extracts the number — extra work that breaks the moment the naming pattern changes. Command-line sort behaves the same way until you add the -V (version) flag, which many people forget or do not have on every platform. Pasting into Text Sorter and picking Natural is the same idea as sort -V, but with nothing to install and no formula to maintain. It is a good fit when the list is a one-off paste from a file listing, a git tag dump, or a chat message rather than something you script repeatedly.

Newest-first ordering

Release notes, changelogs, and deploy logs often read better newest-first. Sort naturally so the numbers order correctly, then toggle reverse to flip the whole list — v12, v11, v10, v9 instead of ascending. The reverse applies after the natural comparison, so two-digit and one-digit versions stay in the right relative place; you are only flipping the finished order, not re-sorting the text.

Privacy and scope

Text Sorter is client-side, so your filenames stay on your device. On scope: natural mode reorders lines by the numbers inside them — nothing more. It does not rename files, pad numbers, resolve semver precedence, or understand build metadata. It is a display-ordering tool, not a version resolver.

Frequently Asked Questions

Is natural sort the same as numeric sort?

No. Numeric mode sorts each line by a single leading number and sends non-numeric lines to the end. Natural mode compares the digit runs embedded inside a string, so 'file2.txt' comes before 'file10.txt' even though both start with the same letters.

Is natural sort the same as semantic version (semver) comparison?

No. Natural sort compares number runs left to right as they appear in the text. It handles '1.2' vs '1.10' correctly, but it does not understand semver rules like pre-release precedence — so '1.0.0-alpha' may not order before '1.0.0' the way semver defines. For strict release ordering, use a semver-aware tool.

Does it handle leading zeros like v01, v02, v010?

Natural sort compares the numeric value of each digit run, so 'v01', 'v02', 'v010' order as 1, 2, 10. It does not rewrite or pad your text; it only changes the order.

What if my lines are pure numbers with no text?

Use Sort List by Number instead. It is built for plain numeric columns and avoids treating the values as strings.

Are my filenames uploaded?

No. Text Sorter runs in your browser, so the list never leaves your device.