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.1or2.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, so1.0.0+aand1.0.0+bhave 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.
- Compare pre-release identifiers left to right, one dot-separated field at a time.
- A field made only of digits is compared numerically, so
alpha.2sorts belowalpha.11. - A field containing letters or hyphens is compared in ASCII order.
- A numeric field always sorts below a non-numeric one.
- 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.0Caret 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.
| Range | Expands to | Why |
|---|---|---|
^1.2.3 | >=1.2.3 <2.0.0 | Left-most non-zero field is the major, so the major is pinned. |
^0.2.3 | >=0.2.3 <0.3.0 | Major is zero, so the minor becomes the breaking field. |
^0.0.3 | >=0.0.3 <0.0.4 | Everything left of the patch is zero, so only that patch matches. |
~1.2.3 | >=1.2.3 <1.3.0 | Patch releases only. |
~1 | >=1.0.0 <2.0.0 | No minor supplied, so minor releases are allowed too. |
1.x | >=1.0.0 <2.0.0 | Wildcard spelling of the same window. |
>=1.2.0 <2.0.0 | both clauses | Space-separated comparators mean AND. |
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?
Why is 1.0.0-beta lower than 1.0.0?
How to use the semantic version checker
- 1Enter or paste your versions.
- 2Enter or paste your range.
- 3Choose the do.
- 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
Related tools
Last updated
More developer tools