SemVer Calculator

Work out the next version number, check which releases an npm range like ^1.2.0 or ~3.1.4 will accept, compare two versions and sort a list correctly. It follows Semantic Versioning 2.0.0 and npm's range rules, including how pre-releases are handled, and runs entirely in your browser.

Bump a version

Used by the pre* bumps. Leave empty for 1.5.0-0 style.

major: Breaking change2.0.0
minor: New feature, backwards compatible1.5.0
patch: Bug fix1.4.3
premajor: First pre-release of the next major2.0.0-beta.0
preminor: First pre-release of the next minor1.5.0-beta.0
prepatch: First pre-release of the next patch1.4.3-beta.0
prerelease: Next pre-release (or first one of the next patch)1.4.3-beta.0

Compare two versions

1.10.0 is newer than 1.9.3 (a minor difference)

Check an npm range

As written in package.json: ^, ~, x, *, >=, <, hyphen ranges like 1.2 - 2.0, and || for either.

Means>=1.2.0 <2.0.0-0
  • 1.1.9does not match
  • 1.2.0matches
  • 1.4.7matches
  • 1.5.0-beta.1does not match
  • 2.0.0does not match

npm would install 1.4.7 (the highest match)

Sort versions

Sorted by SemVer precedence, so 1.10.0 comes after 1.9.0 and 1.0.0-rc.1 before 1.0.0.

Oldest first1.2.0, 1.9.0, 1.10.0-rc.1, 1.10.0, 2.0.0
Newest first2.0.0, 1.10.0, 1.10.0-rc.1, 1.9.0, 1.2.0

Version checking runs in your browser. What you type never leaves this device.

Features

  • Every bump at once: major, minor, patch and the pre-release bumps, with your own label such as beta or rc

  • Range check for ^, ~, x-ranges, hyphen ranges, comparators and || alternatives, written out as plain >= and < bounds

  • Shows which version npm would install from a list: the highest one that matches

  • Compare two versions and see whether they differ by a major, minor, patch or pre-release step

  • Sort by SemVer precedence, so 1.10.0 lands after 1.9.0 and 1.0.0-rc.1 before 1.0.0

When developers reach for it

Cutting a release

Decide between a patch and a minor, or start a release candidate with premajor and the rc label, then copy the exact version into package.json or your git tag.

Debugging a dependency upgrade

A teammate got a different version of a package than you did. Paste the published versions and the range from package.json to see exactly which one npm or pnpm picks.

Choosing caret or tilde

See the real bounds behind ^0.4.2 and ~0.4.2 before you commit. With 0.x versions the caret is much stricter than most people expect.

Ordering release notes

Sort tags pulled from git or a changelog so double-digit minors and pre-releases appear in the right order.

How version ranges work in npm

Caret (^) and tilde (~)

  • ^1.2.3 allows anything below 2.0.0: new features and fixes, but no breaking change.
  • ^0.2.3 allows only 0.2.x, because before 1.0.0 the minor number signals breaking changes.
  • ^0.0.3 allows only 0.0.3 itself.
  • ~1.2.3 allows 1.2.x patches only; ~1 allows any 1.x.x.

Why a pre-release does not match

npm skips versions like 2.0.0-beta.1 unless the range itself mentions a pre-release of the same major.minor.patch. So ^1.2.3 never pulls in 1.3.0-beta, but ^1.3.0-beta.1 accepts 1.3.0-beta.4. This keeps unfinished releases off machines that did not ask for them.

Which bump to use

  • Major: you removed or changed something users rely on.
  • Minor: you added something, and old code still works.
  • Patch: you fixed a bug without changing the public API.
  • Pre-release (alpha, beta, rc): you want testers on the next version before it is final.

SemVer Calculator - FAQ