A little help goes a long way. Find a tool/

Developer

Semver Comparator

Free semver tool. Parse versions like 1.2.3-beta.1, compare two semantic versions by spec precedence rules, or sort a whole list. Build metadata ignored per the spec. Runs in your browser.

YOUR WORKSPACEFree to use. No sign-up.
—
Enter two versions to compare.
—
Press Sort list to order the versions.

Deep dive guides

A LITTLE CONTEXT · 4 MIN READHow Semantic Versioning Works

How semver comparator works

Semantic versioning writes every release as MAJOR.MINOR.PATCH: bump the major when you break the API, the minor when you add features backwards-compatibly, the patch when you fix bugs. An optional prerelease follows a hyphen (1.0.0-alpha, 2.1.0-beta.2) and optional build metadata follows a plus (1.0.0+build.1847). This tool parses any version against the full semver.org grammar — including the subtle rules like numeric prerelease identifiers not being allowed leading zeros.

Comparison follows the spec’s precedence rules exactly. Core numbers compare numerically, which is why 1.2.3 is less than 1.10.0 — a string sort would get that wrong. A version with a prerelease is lower than the same version without one, so 1.0.0-rc.1 comes before 1.0.0. Prerelease identifiers compare one by one: numeric identifiers compare numerically, numeric identifiers rank below alphanumeric ones (1 < beta), alphanumeric ones compare in ASCII order (alpha < beta), and a longer identifier list wins when one is a prefix of the other. Build metadata is ignored entirely, per the spec.

Two modes cover the common needs: compare two versions head to head and get the relation (<, >, =) with the reason it holds, or paste a list of versions to sort — one per line — and get an ascending order with any invalid entries listed separately. Everything runs in your browser, so release lists, changelogs and private package names never leave the page.

Frequently asked questions

Is 1.2 a valid semantic version?
No — semver requires exactly three numeric parts: 1.2.0. Version strings like 1.2 or 1.2.x belong to range notations or looser conventions. The comparator rejects them with an error rather than guessing, because guessing is how accidental ordering bugs happen.
Why is 1.0.0-alpha less than 1.0.0?
By spec, a prerelease version has lower precedence than the associated normal version: 1.0.0-alpha is a pre-release of 1.0.0, so 1.0.0 itself wins. Intuitively, the release is the destination and prereleases are the steps leading to it: alpha < beta < rc < the final 1.0.0.
How do prerelease identifiers compare when both versions have one?
Identifier by identifier, left to right. Numeric identifiers compare numerically (beta.2 < beta.10), numeric identifiers rank below alphanumeric ones (alpha.1 < alpha.beta), alphanumeric ones compare in ASCII order (alpha < beta), and if one list is a strict prefix of the other the shorter one loses (alpha < alpha.1). That is why 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta.
What about the build metadata after the plus?
Ignored for precedence. 1.2.3+build.1847 and 1.2.3+linux are equal by spec precedence — metadata exists to record how the binary was produced, not which release it is. Two versions that differ only in build metadata may still be different artifacts, so treat them as equal-but-not-interchangeable.
Does the v in v1.2.3 matter?
The semver spec does not include a v prefix, but tools like git tag conventions add it everywhere. This comparator accepts an optional leading v (or V) and normalizes it away, so v1.2.3 and 1.2.3 compare as equal — matching how most package ecosystems treat tags in practice.