Semver Calculator and npm Range Checker
About this tool
About Semver Calculator
Find out exactly which versions a package.json range accepts before you publish or upgrade. Type a range such as ^1.2.3, ~0.4, 1.x, >=2.1 <3 or 1.2.3 - 2.0.0 and the calculator shows the comparators it expands to, a plain-English reading, and a pass or fail for every version in your list, along with the highest match. The rules follow npm's own semver package, including the details that trip people up: caret ranges on 0.x versions, the -0 upper bounds, and the rule that a prerelease such as 2.0.0-beta.1 only matches when the range names a prerelease of the same version. Switch to Compare & sort to order versions by Semantic Versioning 2.0.0 precedence and see which part decided it, to Bump for the result of npm version major, minor, patch or any prerelease bump with your identifier, or to Parse to split a version into its parts. Everything is computed locally in your browser.
Built and maintained by Abhi JainUpdated
How to Check a Semver Range
- 1
Enter a range
In Range check, type an npm range such as ^1.2.3 or pick one of the example chips.
- 2
List versions
Paste the versions to test, one per line, in Versions to test. Tick Include prereleases to mimic npm's --include-prerelease.
- 3
Read the result
See the highest matching version, the expanded comparators under Means, and Satisfies or Does not satisfy beside each version.
- 4
Compare or bump
Use Compare & sort, Bump or Parse for precedence, the next version numbers and the parts of a version.
Semver Calculator: questions and answers
What is the difference between ^ and ~ in package.json?
A caret allows changes that do not modify the left-most non-zero number: ^1.2.3 means >=1.2.3 <2.0.0, ^0.2.3 means >=0.2.3 <0.3.0 and ^0.0.3 means only 0.0.3. A tilde allows patch updates only when a minor version is given: ~1.2.3 means >=1.2.3 <1.3.0.
Why doesn't ^1.2.3 match 1.3.0-beta.1?
npm excludes prereleases unless a comparator in the same range is a prerelease of the same major.minor.patch. ^1.2.3-beta.1 would match 1.2.3-beta.2, but 1.3.0-beta.1 needs --include-prerelease. This stops unstable versions from installing by surprise.
How are prerelease versions ordered?
By Semantic Versioning 2.0.0 section 11: a prerelease is lower than its release (1.0.0-rc.1 < 1.0.0), identifiers are compared left to right, numbers numerically, text in ASCII order, numbers below text, and more identifiers win when the rest are equal. So 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
What does the -0 in <2.0.0-0 mean?
It is the lowest possible prerelease of 2.0.0, so <2.0.0-0 excludes 2.0.0 and every 2.0.0 prerelease. npm writes upper bounds this way so that ranges like ^1.2.3 never reach into the next major version's prereleases.
Does build metadata affect version comparison?
No. Anything after + (for example 1.4.0+build.7) is ignored for precedence and range matching, so 1.4.0+a and 1.4.0+b compare as equal.
Ready-made Semver Calculator presets
Related Tools
- Conventional Commit GeneratorWrite Conventional Commits messages with type, scope, breaking changes and footers, checked as you type.
- Git Cheat SheetSearchable git commands by task, with undo recipes for the mistakes everyone makes.
- JSON FormatterBeautify, minify and validate JSON with exact error locations, without changing a single value.
- GitHub URL ParserSplit GitHub URLs into owner, repo, branch and path, and get raw, clone, ZIP and CDN links.