Sort version numbers correctly

Order release tags and build versions the way SemVer expects — where 1.10.0 really is newer than 1.9.0.

Tools used in this guide

The job

A changelog, a list of downloaded builds, or git tags pasted into a document. Plain alphabetical sorting gets it wrong: '1.10.0' sorts above '1.9.0' because text comparison reads one character at a time. Version numbers need each dotted part compared as a number.

How to do it

Paste one version per line and sort oldest-first or newest-first. Dotted numbers compare numerically, an optional leading v or = is accepted, prerelease tags like -rc.2 sort before their release, and +build metadata is ignored. Lines that are not versions are skipped and listed by line number.

  • For a single 'which is newer' question, switch to compare mode and enter two versions.
  • Up to 200,000 characters and 20,000 lines.

Worked example

Sorting v1.9.0, 1.10.0, 1.2.0-rc.1, 1.2.0 oldest-first gives 1.2.0-rc.1, 1.2.0, 1.9.0, 1.10.0 — the release candidate below its release, and 1.10 above 1.9, which plain text sorting reverses.

Limits

This is SemVer-style ordering: calendar versions like 2024.03 are handled numerically (2024.3 equals 2024.30 is not — missing parts read as zero), and non-version lines are dropped rather than guessed. Mixed schemes like dates with names do not sort.