Skip to content
Latchkey

Semantic Versioning Cheat Sheet: SemVer Rules & Ranges

SemVer increment rules and dependency range operators in one reference.

When to bump MAJOR, MINOR, or PATCH - and how version ranges resolve.

Increment rules

BumpWhen
MAJOR (1.0.0)Breaking / incompatible change
MINOR (0.1.0)Backward-compatible feature
PATCH (0.0.1)Backward-compatible bug fix
0.x.yAnything may break (initial dev)

Pre-release & metadata

FormMeans
1.0.0-alpha.1Prerelease (lower precedence)
1.0.0-rc.2Release candidate
1.0.0+build.5Build metadata (ignored in precedence)

npm range operators

RangeMatches
^1.2.3>=1.2.3 <2.0.0 (no major bump)
~1.2.3>=1.2.3 <1.3.0 (patch only)
1.x / 1.*Any 1.y.z
>=1.2.0 <2.0.0Explicit range
1.2.3Exact pin
*Any version

Key takeaways

  • Breaking changes require a MAJOR bump - always.
  • ^ allows minor+patch; ~ allows patch only.
  • Prerelease tags sort below the same version without them.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →