Semver Range Checker
Check which versions satisfy a semver range and see the caret, tilde and hyphen rules expanded into plain comparators.
Comparators:
Range syntax cheat sheet
1.2.3- that exact version and nothing else
^1.2.3- compatible with 1.2.3:
>=1.2.3 <2.0.0-0 ^0.2.3- below 1.0.0 the minor is the breaking digit:
>=0.2.3 <0.3.0-0 ~1.2.3- patch-level changes:
>=1.2.3 <1.3.0-0 1.2.x1.2- any patch of 1.2:
>=1.2.0 <1.3.0-0 1.x1- any 1.y.z:
>=1.0.0 <2.0.0-0 *x- any release version (prereleases still excluded)
1.2.3 - 2.3.4- hyphen range:
>=1.2.3 <=2.3.4 >=1.2.7 <1.3.0- a space means AND: both must hold
^1 || ^2||means OR: either set may match1.0.0-rc.1- a prerelease only matches when a comparator names the same major.minor.patch with its own prerelease tag
How it works
Type a range and a list of versions and this checker tells you, live, which versions
satisfy it. Version parsing and precedence follow
Semantic Versioning 2.0.0 (semver.org), including the rule that
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-beta.2 <
1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0, that numeric
prerelease identifiers compare numerically while alphanumeric ones compare in ASCII order,
and that build metadata after a + is ignored when comparing. The range grammar
is the one npm uses, as defined by node-semver: caret, tilde, x-ranges,
hyphen ranges, whitespace for AND and || for OR.
Every range is first normalised into comparator sets, shown under the range box, so you can
see exactly what ^0.0.3 or 1.2 - 2.3 really mean. Upper bounds are
written as <2.0.0-0 rather than <2.0.0 because
2.0.0-rc.1 sorts below 2.0.0 and would otherwise sneak in.
By the same spec rule, a prerelease version only satisfies a set when one of that set's
comparators names the same major.minor.patch and carries a prerelease tag of its own. Tick
Include prerelease versions for node-semver's includePrerelease
behaviour instead.
The parser is hand-written and runs entirely in your browser: no npm install, no network request, and nothing about your version numbers ever leaves the page.
Frequently asked questions
What does ^1.2.3 mean in package.json?
A caret range allows anything that does not change the left-most non-zero digit, so ^1.2.3 expands to >=1.2.3 <2.0.0-0. Below 1.0.0 the minor is treated as the breaking digit instead: ^0.2.3 means >=0.2.3 <0.3.0-0, and ^0.0.3 means >=0.0.3 <0.0.4-0. A tilde range is narrower: ~1.2.3 only allows patch updates, >=1.2.3 <1.3.0-0. This tool prints the expanded comparators under the range box so you never have to guess.
Why does my prerelease version not satisfy the range?
Semantic Versioning 2.0.0 ranks a prerelease below the release it precedes, so 1.2.3-beta.1 sorts under 1.2.3 and fails >=1.2.3. Even when a prerelease is numerically inside the window, npm only accepts it if one of the range comparators names the same major.minor.patch and carries a prerelease tag of its own, which is why 2.0.0-rc.1 never satisfies ^1.2.3. Tick Include prerelease versions to see node-semver's includePrerelease behaviour instead.
Which semver spec does this checker implement?
Version parsing and precedence follow Semantic Versioning 2.0.0 from semver.org, including numeric identifiers comparing numerically, alphanumeric identifiers comparing in ASCII order, and build metadata after a plus sign being ignored. The range grammar is the one npm uses, defined by node-semver: caret, tilde, x-ranges, hyphen ranges, whitespace for AND and a double pipe for OR. The parser is hand-written and runs entirely in your browser, with no registry lookup and no data leaving the page.