SemVer Range Tester
Tests which versions satisfy a semver range (^1.2.3, ~2.0, >=1 <2) and explains the range as a lower and an upper bound.
Accepts ^1.2.3, ~2.0, >=1 <2, 1.2.x, 1.2.3 - 2.3.4 and ^1 || ^2.
Normalized range
Version by version
| Version | Satisfies? | Matching set | Reason |
|---|
Caret, tilde and prereleases
The caret keeps the leftmost non-zero field fixed, so ^1.2.3 allows up to 1.999.999 while ^0.2.3 stops at 0.2.x, because in the 0.x line the minor field carries the breaking changes. The tilde is stricter: ~1.2.3 only moves the patch. Writing ~1 is the exception, since with no minor there is nothing below to hold, and it behaves like ^1.
A prerelease such as 2.0.0-rc.1 sorts below 2.0.0, so it fits inside >=1.0.0 <2.0.0 by pure comparison. npm still refuses it unless the range itself names a prerelease with the same major.minor.patch, which is why ^1.2.3 never picks up 1.5.0-beta but >=1.5.0-beta.0 does.
What the range ^1.2.3 actually accepts
The package.json asks for ^1.2.3, the lockfile resolved 1.9.5, and someone in code review wants to know whether that is correct. Paste the range and the list of published versions: every line comes back with a tick or a cross, the comparator set that matched and the exact reason for the refusal, such as 2.0.0 above the upper bound <2.0.0. Nothing leaves the browser.
Before any comparison happens, each operator becomes a pair of bounds. The caret ^1.2.3 opens up to but not including 2.0.0, while ^0.2.3 stops at 0.3.0, because on a 0.x line it is the minor field that carries breaking changes. The tilde ~1.2.3 only frees the patch. Wildcards like 1.2.x, hyphen ranges like 1.2.3 - 2.3.4 and double-bar alternatives are normalized too, so two ranges written differently can be compared.
The trap is the prerelease. By plain ordering, 2.0.0-rc.1 sorts below 2.0.0 and would fit inside ^1.2.3, yet npm only accepts a hyphenated version when the range itself names a prerelease with the same major.minor.patch. That is why ^1.2.3 never installs 1.5.0-beta while >=1.5.0-beta.0 <2.0.0 installs it without complaining. The include-prereleases box shows both scenarios side by side.
Frequently asked questions
What is the practical difference between ^1.2.3 and ~1.2.3?
Why is the beta version reported as refused?
What do 1.2.x and ^0.0.3 mean?
Related Tools
package.json Generator
Build a minimal package.json: name, version, description, scripts, license, repository, type (module/commonjs). Everything in your browser.
JSON Comparator
Compare two JSON objects and visualize differences side by side: added, removed and changed fields. Supports nested structures. Processed in your browser.
i18n Translation File Diff
Compares two i18n JSON files and reports missing, extra and empty keys plus placeholder mismatches between the two locales.