SemVer 2.0.0 precedence, made obvious

Semantic Version Comparator

Compare two SemVer values online and see which one wins—and the exact version part that decided it.

Version showdown

Which version is newer?

Valid SemVer

Valid SemVer

Version A wins

2.4.0 is newer

A stable release has higher precedence than its prerelease.

A2.4.0B2.4.0-beta.3
Precedence path

How SemVer reached the result

Prerelease decides

Build metadata is ignored when comparing precedence.

Compared locally in your browser. Nothing is uploaded.
One click, instant answer

Try a tricky comparison

These are the cases that catch people—and string sorters—off guard.

The rules in 60 seconds

How semantic version comparison works

A semantic version follows MAJOR.MINOR.PATCH, with optional prerelease and build labels. Compare from left to right and stop at the first difference.

2major. 4minor. 1patch -beta.2prerelease +linuxbuild
  1. 01

    Major first

    3.0.0 outranks every 2.x.x version.

  2. 02

    Then minor and patch

    Numbers are numeric: 1.10.0 is newer than 1.9.9.

  3. 03

    Prereleases come before releases

    2.0.0-rc.1 has lower precedence than 2.0.0.

  4. 04

    Build labels do not decide

    1.0.0+a and 1.0.0+b have equal precedence.

Quick answers

SemVer comparator online FAQ

How do I compare semantic versions?

Compare major, minor, and patch as numbers, in that order. If they match, compare prerelease identifiers. A normal release always outranks a prerelease with the same core version.

Is 1.10.0 newer than 1.9.0?

Yes. Semantic version parts are numeric, so minor version 10 is greater than minor version 9. A plain text or alphabetic sort can get this wrong.

Is 2.0.0-beta newer than 2.0.0?

No. A prerelease such as 2.0.0-beta has lower precedence than the stable 2.0.0 release.

How are prerelease labels compared?

Identifiers are compared from left to right. Numeric identifiers compare numerically and have lower precedence than non-numeric identifiers. If all shared identifiers match, the version with more identifiers wins.

Does build metadata affect version order?

No. Anything after + identifies a build but does not affect SemVer precedence. Two versions that differ only in build metadata compare as equal.

Can I compare versions with a leading v?

Yes. For convenience, this online comparator accepts common inputs such as v1.2.3 and normalizes them to 1.2.3.