Semver Calculator: Version Comparison & Range Checker
Compare two semantic versions, or check whether versions satisfy a range expression such as ^1.2.3, ~1.2, >=1.0.0 <2.0.0, 1.x, 1.2.3 - 2.0.0 or ||, just like the ranges in package.json. Paste a whole list of versions to see which ones match and sort them in ascending or descending order. Matching follows npm (node-semver) rules, and everything runs in your browser. Nothing you type is ever sent to a server.
🔒 Runs in your browser · Your data is never sent to a server
Compare two versions
Check against a range
| Input | Normalized | Result |
|---|
Notes
- Range matching follows the default (strict) mode of npm's node-semver. Short forms like "1.2" work inside a range expression but are not accepted in the version list.
- A prerelease version (e.g. 1.3.0-beta.1) does not satisfy a range by default unless the range has a prerelease comparator for the same major.minor.patch (e.g. ^1.3.0-beta.0). Turn on "Include prereleases" to match them anyway.
- Build metadata after "+" (e.g. 1.0.0+build.5) is ignored in comparisons and range matching.
- Other versioning schemes such as Python (PEP 440) or RubyGems are not supported.
Glossary
Semantic versioning (semver)
A convention that writes a version as MAJOR.MINOR.PATCH. Bump major for breaking changes, minor for backward-compatible features, and patch for bug fixes.
Caret range (^)
Allows changes that do not modify the left-most non-zero digit. ^1.2.3 means >=1.2.3 <2.0.0, ^0.2.3 means >=0.2.3 <0.3.0, and ^0.0.3 matches only 0.0.3.
Tilde range (~)
Allows patch-level updates when a minor version is given, or minor-level updates when it is not. ~1.2.3 means >=1.2.3 <1.3.0 and ~1 means >=1.0.0 <2.0.0.
Prerelease (-beta.1 etc.)
An identifier after a hyphen that marks a pre-release build. It sorts below the same release version, and identifiers are compared left to right: numbers numerically, words as strings, with numbers sorting lower than words.
FAQ
What is the difference between ^1.2.3 and ~1.2.3?
^1.2.3 means >=1.2.3 <2.0.0 (minor and patch updates allowed), while ~1.2.3 means >=1.2.3 <1.3.0 (patch updates only). Versions starting with 0 are stricter: ^0.2.3 means >=0.2.3 <0.3.0 and ^0.0.3 matches only 0.0.3.
Why does 1.5.0-beta.1 not satisfy ^1.0.0?
In npm's rules, a prerelease version only satisfies a range if the range itself contains a prerelease comparator on the same major.minor.patch (for example ^1.5.0-alpha). This keeps unstable builds from sneaking in. Turn on "Include prereleases" in this tool to treat them as normal versions.
Which is newer, 1.0.0-beta.2 or 1.0.0-beta.11?
beta.11 is newer. Prerelease identifiers are split on dots and compared left to right; numeric identifiers are compared as numbers (2 < 11). Alphanumeric identifiers are compared as strings, and numeric ones always sort lower than alphanumeric ones.
Are 1.0.0+build.1 and 1.0.0+build.2 treated as different?
No. Build metadata after "+" does not take part in precedence, so both have the same rank.
Can I compare short versions like "1.2" or "1"?
Version-to-version comparison needs the full X.Y.Z form. Short forms such as "1.2" or "1.x" are accepted only inside a range expression, where "1.2" expands to >=1.2.0 <1.3.0.
Share this page
