Tools / Semver Range Tester

Semver Range Tester.

Test which versions satisfy an npm or Composer range such as ^1.2.3, ~2.0 or >=7.4 <9.

Runs in your browser

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Results
Summary

About Semver Range Tester

Semver Range Tester shows exactly which versions a dependency range accepts. Type a range such as ^1.2.3 || ~2.0, paste a list of versions, and every line is marked yes or no, with the highest and lowest matching version in the summary. The range is also expanded into plain comparators, so ^1.2.3 becomes >=1.2.3 <2.0.0-0 and you can see the real upper bound instead of guessing it. Two rule sets are supported. npm mode follows node-semver: caret keeps the left-most non-zero part fixed, so ^0.2.3 only allows 0.2.x, tilde allows patch updates, x-ranges and hyphen ranges work as documented, and pre-release versions such as 1.9.0-beta.1 only match when the range itself names a pre-release of the same version, unless you switch on pre-releases. Composer mode follows composer/semver, which differs in ways that regularly surprise people: ~1.2 means >=1.2 <2.0 (not <1.3 as in npm), a comma or a space means AND, a single | also means OR, versions can have four parts, and stability suffixes like -beta2, -RC1 or -dev are ordered dev < alpha < beta < RC < stable. In Composer mode the constraint is tested on its own: minimum-stability and @dev flags only affect the solver, so they are ignored here. A frequent mistake this tool catches is writing ^0.1 and expecting 0.2.0 to be allowed. Invalid versions are flagged per line, and nothing leaves your browser.

How to Use

  1. Enter the range or constraint and choose npm or Composer rules.
  2. Paste the versions to test, one per line.
  3. Read the results and the expanded range in the summary.

Frequently Asked Questions

Why does ^0.2.3 not match 0.3.0?

For versions below 1.0.0 the caret keeps the minor version fixed, because in semver a 0.x minor release may break compatibility. ^0.2.3 means >=0.2.3 <0.3.0.

Why does my pre-release not match ^1.2.3?

npm only lets pre-releases match when the range names a pre-release of the same major.minor.patch. Turn on "include pre-releases" to test them like normal versions.

How is Composer's tilde different from npm's?

In Composer, ~1.2 allows everything up to 2.0 and ~1.2.3 allows up to 1.3. In npm, ~1.2 and ~1.2.3 both stop at 1.3.0.

Is anything sent to a server?

No. Ranges are parsed and tested in your browser, and the page makes no network requests while you use it.

Related Tools