Skip to main content
Software Version / Package Tools

Version Range Calculator

Expand an npm/SemVer range such as ^1.2.3 or 1.x into exact bounds, find the lowest matching version, test versions and check whether two ranges overlap.

Enter a version range in npm syntax to expand it into precise lower and upper bounds, then test versions against it or compare it with a second range.

Useful when two dependencies need the same package: if their ranges don't overlap, no single version can satisfy both.

Ranges starting with 0 behave differently - ^0.2.3 only allows patch updates - so check them here before relying on automatic updates.

What Is the Version Range Calculator?

It expands the shorthand used in package.json and many other tools - ^, ~, x/* wildcards, hyphen ranges, comparison operators and || - into exact comparators, using the same rules as npm's node-semver library.

When to Use It

  • Choosing how loose a dependency range should be.
  • Checking why a version was or wasn't installed.
  • Seeing whether two packages that need the same dependency can agree on one version.

How to Use It

  1. Enter a range or click an example.
  2. Optionally list versions to test and a second range to check overlap.
  3. Tick "Include prereleases" to mimic --include-prerelease.

Examples

  • ^1.2.3 → >=1.2.3 <2.0.0-0 (any 1.x from 1.2.3).
  • ^0.2.3 → >=0.2.3 <0.3.0-0; ^0.0.3 → only 0.0.3.
  • ~1.2 → >=1.2.0 <1.3.0-0.
  • 1.2.3 - 2.3 → >=1.2.3 <2.4.0-0.

Understanding the Result

An upper bound like <2.0.0-0 means "below 2.0.0, and none of 2.0.0's prereleases either". By default a prerelease only matches if the range names a prerelease of the same MAJOR.MINOR.PATCH - so ^1.2.3 does not match 1.5.0-beta. The lowest matching version is what a range with no upper limit starts from.

Limitations

This follows npm/node-semver syntax. Composer's ~ means something different - use the Composer Version Constraint Helper - and Python uses PEP 440 specifiers. To check a spec against a package's published versions, use the npm Package Version Checker.

Frequently Asked Questions

^1.2.3 allows any 1.x.x from 1.2.3 upward; ~1.2.3 only allows 1.2.x patches from 1.2.3.

For 0.x versions the caret treats the minor number as breaking, so ^0.2.3 means >=0.2.3 <0.3.0.

By default a prerelease only matches if the range names a prerelease of the same MAJOR.MINOR.PATCH. Tick "Include prereleases" to allow them.
Share this tool: