Semantic Version Calculator

An online semver calculator for bumping versions (major/minor/patch/prerelease), comparing two versions, and testing whether a version satisfies a ^ or ~ npm range, following the semver.org specification.

FreeOnline Tool
Loading…

How to Use

  1. Bumping: enter the current version, choose the bump type (major, minor, patch or prerelease) and press "Calculate next version"
  2. Comparing: enter version A and version B and press "Compare" to see which one is newer
  3. Range matching: enter a concrete version plus an npm range expression (such as ^1.2.3 or ~1.2.3) and press "Check" to see whether it satisfies the range
  4. Press "Load sample versions" to fill all three sections with example data

Features

  • Version validation that follows the semver.org format strictly (major.minor.patch[-prerelease][+build])
  • Four bump types: major (zeroing minor and patch), minor (zeroing patch), patch and prerelease, with behavior modeled on mainstream semver tooling such as npm version, including details like not double-incrementing when you are already on the target prerelease
  • Version comparison following semver precedence rules: a release outranks a prerelease of the same numbers, and prerelease identifiers are compared segment by segment (numeric identifiers numerically, alphanumeric identifiers by ASCII, with purely numeric identifiers ranking below alphanumeric ones)
  • Simplified range matching: only the two most common prefixes ^ (compatible updates) and ~ (patch-level updates) plus exact matching without a prefix. Complex expressions using >=, || or the x wildcard are not supported

Use Cases

Choosing the next release number
Work out the correct next semver version from the kind of change you made - breaking API change, new feature or bug fix
Checking whether a dependency satisfies a range
Test whether the pinned version in package.json satisfies a ^ or ~ declaration when chasing down a dependency conflict
Comparing two versions
Determine quickly which of two version numbers is newer when handling an upgrade or a rollback, instead of eyeballing it
Learning prerelease precedence
Try different prerelease identifier combinations to understand how alpha, beta and rc versions rank against each other

FAQ

Which range syntax is supported?
Only the two most common npm prefixes: ^ (compatible updates, such as ^1.2.3) and ~ (patch-level updates, such as ~1.2.3), plus an exact version with no prefix. More complex ranges using >=, <=, || combinations or the x wildcard are not supported.
How exactly does a prerelease bump work?
If the current version has no prerelease tag, patch is incremented and -0 is appended (1.2.3 becomes 1.2.4-0). If a prerelease tag exists and its last segment is numeric, that number is incremented (1.2.4-0 becomes 1.2.4-1). If the last segment is not numeric, .0 is appended (1.2.4-alpha becomes 1.2.4-alpha.0).
Does build metadata (after the + sign) affect comparison?
No. Under the semver.org specification build metadata only identifies the build and does not affect version precedence, so the comparison here ignores it.
Why does 1.0.0-alpha rank below 1.0.0?
The semver specification says a version with a prerelease tag has lower precedence than the release with the same numbers, because a prerelease is treated as an intermediate state on the way to that release.