Version range
Runs in your browser· a calculator: nothing you type is sent anywhere
- Allows 1.2.3 or higher, below 2.0.0.
3 of 9 versions satisfy ^1.2.3; highest: 1.9.0
- does not satisfy: 0.9.0
- does not satisfy: 1.0.0
- does not satisfy: 1.2.0
- satisfies: 1.2.3
- satisfies: 1.2.9
- does not satisfy: 1.3.0-beta.1
- satisfies: 1.9.0
- does not satisfy: 2.0.0
- does not satisfy: 2.1.0-rc.1
A prerelease such as 1.3.0-beta.1 only matches when the range itself names a prerelease of the same version, or when “Include prereleases” is on. That is how npm behaves.
Compare and bump
Numbers are compared as numbers (1.10.0 is higher than 1.9.0), not as text. Build metadata after + is ignored.
- major 2.0.0
- minor 1.3.0
- patch 1.2.4
- premajor 2.0.0-rc.0
- preminor 1.3.0-rc.0
- prepatch 1.2.4-rc.0
- prerelease 1.2.4-rc.0
Check npm semver ranges, compare versions and bump them
Type a version range as it appears in package.json and see, in plain words, which versions it allows, then test a list of versions against it and find the highest match. Caret, tilde, x-ranges, hyphen ranges, comparators and || are supported, with npm's rule for prereleases. A compare box orders two versions numerically and a bump list shows the next major, minor, patch and prerelease versions. It runs in your browser.
Frequently Asked Questions
- What does ^1.2.3 mean in package.json?
- The caret allows changes that do not change the leftmost non-zero number: ^1.2.3 means 1.2.3 or higher but below 2.0.0. For 0.x versions it is stricter: ^0.2.3 means 0.2.3 up to below 0.3.0, and ^0.0.3 allows only 0.0.3. Type any range above to see exactly what it allows.
- What is the difference between ^ and ~?
- The tilde allows only patch updates when a minor version is given: ~1.2.3 means 1.2.3 up to below 1.3.0, while ^1.2.3 allows up to below 2.0.0. ~1 allows anything from 1.0.0 up to below 2.0.0.
- Why does my range not match a prerelease like 1.3.0-beta.1?
- In npm a prerelease version only satisfies a range if some part of the range names a prerelease of the same major.minor.patch, for example >=1.3.0-beta.0. So ^1.2.3 does not match 1.3.0-beta.1. Tick "Include prereleases" to see the result when prereleases are allowed.
- Does it behave exactly like npm?
- It follows the rules of the node-semver package that npm uses for ranges (caret, tilde, x-ranges, hyphen ranges, comparators and ||), and is checked against that package. It does not cover other ecosystems: Python (PEP 440), Maven and Cargo have their own version and range rules.
Related Tools
Found this useful? Hexabench is free and ad-free. If it saved you time, you can support it.
Buy me a coffee →