Semver Range Checker
Type a version range as npm or Cargo writes it (^1.2.3, ~1.2, 1.x, >=1.0 <2, 1.2 - 1.4 || 2) to see what it means in plain comparators and words, and which of your versions it matches, pre-releases included.
About this tool What it's for, how to use it and an example
What it's for
Package managers pick a dependency’s version from a range such as ^1.2.3 or ~1.2, and the rules (above all
for 0.x versions and pre-releases) aren’t obvious. This shows exactly what a range allows and which versions
it matches.
For example, when npm install won’t pick up 1.10.0-beta.1 although your package.json says ^1.2.3, test
it here to see that a pre-release is only matched when the range itself names one.
How to use it
Type the range and choose the Rules:
- npm follows node-semver, as used by npm, pnpm and Yarn:
^,~,xand*wildcards, partial versions (1.2), comparators (>=1.0.0 <2), hyphen ranges (1.2 - 1.4) and||between alternatives. - Cargo follows Rust’s
Cargo.toml: requirements separated by commas, all of which must hold, and a bare version such as1.2meaning^1.2.
Comparators gives the range in the plain form the tools compare against (<2.0.0-0 means below 2.0.0 and
none of its pre-releases), and In words says the same. Type versions to test, separated by spaces, commas or
lines, and each one is marked, with the highest match named. The rules choice is remembered. Copy a link to
this input keeps the range and versions.
Example
Choose Try an example, which types this range:
^1.2.3 || >=2.1.0 <2.3
It means at least 1.2.3 and below 2.0.0, or at least 2.1.0 and below 2.3.0. Of the example’s versions, 1.2.3, 1.9.0 and 2.1.5 match, and the highest is 2.1.5; 1.10.0-beta.1 doesn’t, being a pre-release.
Good to know
The npm rules are those of node-semver without its includePrerelease and loose options. Build metadata
(+build.5) is ignored when comparing, as semver says. Other ecosystems differ: Python, Ruby (~>) and Maven
ranges aren’t read, except that ~> is taken as npm’s ~.
| Version | Matches | Why not |
|---|
Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.
Saved you a few minutes? Say thanks with a coffee.
Something wrong with this tool, or missing from it? Report a bug or suggest a feature.