Skip to content
Convertto

Semantic Version Checker

Test versions against a range, sort by precedence, or compare two releases.

Semantic version ranges decide which releases an installer accepts. The caret allows anything that does not change the leftmost non-zero number, the tilde allows patch changes only, and pre-releases always sort below the matching release. This tool tests a list against a range, sorts by precedence, or compares versions directly.

Runs in your browser
Privacy
Runs entirely in your browser — nothing is uploaded
Cost
Free, unlimited, no sign-up

What makes a version valid

Semantic Versioning 2.0.0 defines a version as MAJOR.MINOR.PATCH, where each field is a non-negative integer with no leading zeroes. 1.2 is not a valid version, 01.2.3 is not either, and the v in v1.2.3 is a tagging convention rather than part of the version itself. Two optional suffixes may follow the patch number.

  • Pre-release: a hyphen, then dot-separated identifiers built from ASCII letters, digits and hyphens, as in 1.0.0-alpha.1 or 2.0.0-rc.2. A numeric identifier may not carry a leading zero.
  • Build metadata: a plus sign, then dot-separated identifiers from the same character set, as in 1.0.0+build.5. It is ignored entirely when two versions are compared, so 1.0.0+a and 1.0.0+b have equal precedence.

The spec also fixes what each number means: patch for backward-compatible fixes, minor for backward-compatible additions, major for anything that breaks the documented public API. Major version zero is the stated exception, where the API is declared unstable.

Precedence, and where pre-releases sort

Precedence compares major, then minor, then patch, each numerically. When all three are equal, a version carrying a pre-release has lower precedence than the same version without one, because a pre-release is by definition not yet the release. That one rule is why publishing 1.0.0-hotfix after 1.0.0 is never picked up by an installer resolving ^1.0.0.

  1. Compare pre-release identifiers left to right, one dot-separated field at a time.
  2. A field made only of digits is compared numerically, so alpha.2 sorts below alpha.11.
  3. A field containing letters or hyphens is compared in ASCII order.
  4. A numeric field always sorts below a non-numeric one.
  5. If every shared field is equal, the version with more fields has higher precedence.

Applied to one release train, lowest first, the rules produce the order below. It is the example the specification itself gives.

1.0.0-alpha
1.0.0-alpha.1
1.0.0-alpha.beta
1.0.0-beta
1.0.0-beta.2
1.0.0-beta.11
1.0.0-rc.1
1.0.0

Caret and tilde ranges

The caret allows any release that does not change the left-most non-zero field. That one definition covers every case, including the behaviour people find surprising below 1.0.0. The tilde pins the minor and allows patch releases only.

RangeExpands toWhy
^1.2.3>=1.2.3 <2.0.0Left-most non-zero field is the major, so the major is pinned.
^0.2.3>=0.2.3 <0.3.0Major is zero, so the minor becomes the breaking field.
^0.0.3>=0.0.3 <0.0.4Everything left of the patch is zero, so only that patch matches.
~1.2.3>=1.2.3 <1.3.0Patch releases only.
~1>=1.0.0 <2.0.0No minor supplied, so minor releases are allowed too.
1.x>=1.0.0 <2.0.0Wildcard spelling of the same window.
>=1.2.0 <2.0.0both clausesSpace-separated comparators mean AND.
Range behaviour as node-semver implements it.

Two whole ranges separated by a double pipe are an OR, so 1.0.0 || >=2.0.0 matches the one pinned release and everything from 2.0.0 upward, and nothing in between.

Frequently asked questions

Why does ^0.2.3 behave differently from ^1.2.3?

Major version zero means the API is unstable, so semver treats the minor number as the breaking-change field. ^1.2.3 allows anything below 2.0.0, but ^0.2.3 allows only up to 0.3.0.

Why is 1.0.0-beta lower than 1.0.0?

A pre-release identifier means the version is not yet the real release, so it always sorts below it. That is why publishing 1.0.0-beta after 1.0.0 is never picked up by a range like ^1.0.0.

How to use the semantic version checker

  1. 1Enter or paste your versions.
  2. 2Enter or paste your range.
  3. 3Choose the do.
  4. 4The result appears immediately — copy or download it.

Sources & specifications

Embed this tool

Put the working semantic version checker on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.

Share this tool

Last updated

More developer tools