SemVer 2.0.0 Standard · Range Satisfier (^ & ~) · Diff Engine
SemVer Calculator & Range Tester
Calculate version bumps according to the official SemVer 2.0.0 specification. Verify whether a package release satisfies caret, tilde, and inequality range constraints.
Sample:
Major1
Minor4
Patch2
Prereleasealpha.1
Build MetaNone
Next Version Increments
Range Expression Compatibility Tester (^, ~, >=, <)
Target Version: 1.4.2-alpha.1
Accepts >= 1.2.0 and < 2.0.0
Compare Two Versions (A vs B)
Version A
Version B
Major Breaking Bump
Increments MAJOR version. Backwards-incompatible API changes.
Semantic Versioning 2.0.0 Architecture & Package Range Rules
The Three Core Version Numbers
Given a version number MAJOR.MINOR.PATCH, increment each according to:
- MAJOR: Incremented when making incompatible API breaking changes. Resets MINOR and PATCH to 0.
- MINOR: Incremented when adding functionality in a backwards-compatible manner. Resets PATCH to 0.
- PATCH: Incremented when making backwards-compatible bug fixes without introducing new features.
- Pre-release: Denoted by appending a hyphen and identifiers (e.g.,
1.0.0-alpha.1). Pre-release versions have lower precedence than the normal version.
Caret (^) vs. Tilde (~) Range Syntax
Understanding range prefixes in package.json prevents unexpected production regressions:
- Caret
^1.2.3: Allows changes that do not modify the leftmost non-zero digit. For^1.2.3, accepts>= 1.2.3 < 2.0.0. For^0.2.3, accepts>= 0.2.3 < 0.3.0. - Tilde
~1.2.3: Allows patch-level changes if minor is specified. For~1.2.3, accepts>= 1.2.3 < 1.3.0. - Wildcards
1.x: Matches any version with major 1.
Why Build Metadata is Ignored in Precedence
Build metadata (denoted with a plus sign, e.g. 1.0.0+20130313144700) is purely informational. In SemVer 2.0.0, 1.0.0+build.1 and 1.0.0+build.999 have identical precedence when package managers resolve dependency trees.