Semantic version checker
Compare two semantic versions and test whether one satisfies an npm version range.
Runs in your browser. Your input is not uploaded.
Loading the tool…
What it does, how to use it, and questions
What it does
A semantic version is major.minor.patch, with an optional prerelease (1.2.3-beta.1) and build metadata (1.2.3+exp.sha). npm ranges such as ^1.2.0 and ~1.2.0 describe which of those versions a package will accept.
The rules are npm’s semver package. 1.2 is rejected: a version needs all three numbers. ^1.2.0 allows 1.x and not 2.0.0.
How to use it
- Enter a version such as
1.4.2. - Enter another version to compare, or a range such as
^1.2.0, or both. - Tick Include prereleases if a range should match
1.2.3-beta.
Example
Input
1.4.2 against ^1.2.0
Output
1.4.2 satisfies ^1.2.0
Things to watch for
^1.2.0does not match1.2.3-beta.1unless prereleases are included. That matches npm install.~1.2.0only allows patch updates.^0.2.0only allows patch updates too, because a zero major version is treated as unstable.- Python and Cargo are close to these rules and not identical. This page is npm.
Questions
- What does the caret in ^1.2.0 mean?
- Allow changes that do not modify the left-most non-zero number.
^1.2.0matches1.9.0and not2.0.0. - What does the tilde in ~1.2.0 mean?
- Allow patch updates only, so
1.2.9matches and1.3.0does not. - Why is 1.2 rejected?
- It is not a full semantic version. Write
1.2.0. Ranges may use1.2.x, and that belongs in the range field. - Does this talk to the npm registry?
- No. It only compares the versions you type.