Semver Calculator & Range Tester
Test versions against ranges, bump levels, and compare any two semver values. Implements the npm-flavored range syntax: caret, tilde, hyphen, x-ranges, AND, OR.
Valid: 1.2.3
Try: ^1.0 || ~2.5 || >=3.0 <4.0
Major
1
Minor
2
Patch
3
Range satisfaction
✓ satisfies
Show comparator expansion
>=1.0.0 AND <2.0.0
Bumps
- major:2.0.0
- minor:1.3.0
- patch:1.2.4
- prerelease:1.2.4-beta.0
Compare
1.2.3vs
1.2.3 < 1.2.5
gt ·
gte ·
lt ✓
lte ✓
eq ·
About Semver Calculator & Range Tester
Test whether a version satisfies a semver range, bump a version to the next major/minor/patch/prerelease, and compare any two versions. Implements the npm-flavored range syntax: caret, tilde, hyphen ranges, x-ranges, AND (space-separated), and OR (||).
Range syntax quick reference
^1.2.3— ≥1.2.3 <2.0.0~1.2.3— ≥1.2.3 <1.3.01.2.x— ≥1.2.0 <1.3.01.2.3 - 2.0.0— ≥1.2.3 ≤2.0.0^1 || ^2— any 1.x.x or 2.x.x>=1.2 <2.0— AND of two comparators
Frequently asked
- What is semantic versioning?
- Semantic versioning (semver) is a versioning scheme where a version number has three parts: MAJOR.MINOR.PATCH. MAJOR increments for breaking changes, MINOR for new backwards-compatible features, and PATCH for backwards-compatible bug fixes. Pre-release versions append a hyphen and identifier (e.g. 1.2.3-beta.1). Build metadata appends a plus sign (e.g. 1.2.3+build.42).
- What does the caret (^) range mean?
- The caret allows changes that do not modify the left-most non-zero digit. ^1.2.3 means >=1.2.3 <2.0.0 (any 1.x.x). ^0.2.3 means >=0.2.3 <0.3.0 (any 0.2.x). ^0.0.3 means >=0.0.3 <0.0.4 (only 0.0.3). This is the npm default for installed packages.
- What does the tilde (~) range mean?
- The tilde allows patch-level changes. ~1.2.3 means >=1.2.3 <1.3.0 (any 1.2.x). ~1.2 means >=1.2.0 <1.3.0. ~1 means >=1.0.0 <2.0.0. Use tilde when you want to accept bug fixes but not new features.
- How do pre-release versions compare?
- Pre-release versions have lower precedence than the associated normal version: 1.2.3-alpha < 1.2.3. Among pre-release identifiers, numeric identifiers sort numerically (1.2.3-alpha.1 < 1.2.3-alpha.2) and alphanumeric identifiers sort lexicographically (1.2.3-alpha < 1.2.3-beta). A numeric identifier always has lower precedence than an alphanumeric one.
- Does a pre-release version satisfy a range?
- By default, pre-release versions only satisfy ranges that explicitly include a pre-release comparator on the same MAJOR.MINOR.PATCH tuple. 1.2.3-beta.1 does not satisfy ^1.2.2 even though 1.2.3 does. This prevents accidentally pulling in pre-release versions when you specify a stable range.