Skip to content
shellhacks.dev

Semver Range Checker

Test which versions satisfy an npm or Composer constraint such as ^1.4.2, ~1.4, 1.x or ^1.4 || ^2.0, and see what the range expands to.

Free · No sign-up · Your inputs stay in your browser

Input

Test a semver range

Output

Highest match: 1.9.0

Means

>=1.4.2 <2.0.0-0

VersionSatisfies
1.4.1no
1.4.2yes
1.9.0yes
2.0.0no
2.0.0-beta.1no
1.5.0-rc.1no

The ^ operator allows changes that do not touch the left-most non-zero part, so ^0.3.1 stops before 0.4.0. ~1.4 is where the ecosystems disagree: npm reads it as >=1.4.0 <1.5.0, Composer as >=1.4 <2.0. Pre-releases only match a range that names a pre-release of the same version, so 2.0.0-beta.1 never satisfies ^1.4.2.

Runs in this browser. Nothing you paste is sent to a server.

Caret and tilde

Under Semantic Versioning, a major version may break compatibility. ^1.4.2 therefore allows anything below 2.0.0, while for 0.x versions, which promise nothing, ^0.3.1 stops at 0.4.0. ~1.4.2 allows patch releases only.

Where npm and Composer differ

For three-part versions they agree. With two parts, npm reads ~1.4 as 1.4.x and Composer as anything from 1.4 below 2.0. Composer also separates AND conditions with commas or spaces and applies minimum-stability to pre-releases, where npm uses its own pre-release rule.

Share

Frequently asked questions

What does ^ mean in package.json?
Compatible with: any version that does not change the left-most non-zero number. ^1.4.2 allows 1.4.2 up to, but not including, 2.0.0.
Why doesn't 2.0.0-beta.1 satisfy ^1.4.2?
It is above the range, and pre-releases only match a range that names a pre-release of the same major, minor and patch.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools