Semver Range Checker
runs in your browserDoes 1.4.2 satisfy ^1.2.0? Check any list of versions against a range, with the answer npm itself would give and the range put into plain words.
Versions
42 charsDoes the range take it?
Answers appear here.
What the operators mean
press one to try it- exactly that version
- no breaking change: up to but not including 2.0.0
- below 1.0.0 a minor bump is breaking, so up to 0.3.0
- patches only: up to but not including 1.3.0
- any 1.x.x
- two comparators, both must hold
- a hyphen range, both ends included
- either range
- anything
about this tool
Does this version satisfy that range?
Type a range, paste a list of versions, and get a yes or no for each one — plus the newest version in the list the range actually takes, which is usually the number you came for.
The answer npm would give
The range arithmetic is npm's own semver package, running in your browser.
That is the entire design decision. Ranges look simple and are not: carets behave differently below 1.0.0, hyphen ranges include both ends, x-ranges and unions compose, and prereleases have their own precedence rules. A hand-written parser that disagreed with npm on one of those corners would be wrong in exactly the case somebody opened this page to settle. So it does not exist — the library does the arithmetic and this page does the explaining.
The range in plain words
^1.2.0 is shown as "1.2.0 up to but not including 2.0.0". ~1.2.3 as "1.2.3
up to but not including 1.3.0".
The one worth reading carefully is the caret below 1.0.0. Semver treats a minor
bump as breaking while a package is still in 0.x, so ^0.2.3 allows 0.2.x but
not 0.3.0, and ^0.0.3 allows nothing but itself. That is the rule people
most often get wrong, and it is why the explanation is generated for your range
rather than written once in the docs.
Prereleases
^1.2.0 does not take 2.0.0-beta.1. It does not take 1.5.0-rc.1 either.
Prereleases are excluded unless the range names one, which is deliberate in the
specification: a prerelease is not a normal candidate for installation, so you
opt into it explicitly with something like >=1.5.0-rc.1.
Pasting a changelog
Versions can be one per line or comma separated, and a leading v is fine
because that is how changelogs write them. A line that is not a version at all —
a heading, a date — is marked unreadable beside the others rather than failing
the whole list, since a pasted changelog always has one.
Nothing is sent
The check runs in your browser. The library is a sizeable one, so it is fetched when you open this page rather than shipped to everyone who visits the site.
For the lockfile that these ranges resolve into, the JSON formatter will make it readable.
questions
- Is this the same answer npm would give?
- Yes, because it is npm’s own code. The range arithmetic comes from the semver package that npm uses, loaded into your browser. A hand-written range parser that disagreed on one corner would be wrong in exactly the case you came here to check, which is why none was written.
- What is the difference between ^ and ~?
- The caret allows anything up to the next major: ^1.2.3 takes 1.9.9 but not 2.0.0. The tilde allows patches only: ~1.2.3 takes 1.2.9 but not 1.3.0. Both are explained in plain words on the page for whatever range you type.
- Why does ^0.2.3 behave differently?
- Below 1.0.0 semver treats a minor bump as breaking, so the caret tightens: ^0.2.3 allows 0.2.x but not 0.3.0, and ^0.0.3 allows nothing but 0.0.3. It is the rule people most often forget, so the page spells it out for any 0.x range you enter.
- Why is 2.0.0-beta.1 rejected by ^1.2.0?
- Prereleases are excluded unless the range asks for one. That is deliberate in semver: a prerelease is not considered a normal candidate, so you only get one if you name a prerelease in the range yourself, as in >=1.5.0-rc.1.
- Can I paste a changelog?
- Yes. Versions can be one per line or comma separated, a leading v is fine, and any line that is not a version — a heading, a date — is marked as unreadable beside the others rather than failing the whole list.