SemVer Parser and Range Tester

Enter a complete version and a range to see whether they match. A range may be exact (1.2.3), comparative (>=1.2.3), open (1.x), a hyphen range (1.2.3 - 2.0.0) or an alternative (^1.2.3 || ~2.0.0).

Runs locally in your browser
This tool processes all data locally in your browser.
Version and rangeSupports exact versions, comparators, caret ranges, tilde ranges and || alternatives.

How to read a version and test a range

Type a version and a range, then press Inspect version: 2.4.1-beta.2+build.19 is split into major, minor, patch, prerelease and build fields, and the range is tested against it. Everything runs in this browser, so no registry is queried and no package is installed.

The verdict follows npm's semver, the implementation every package manager uses: the ranges that would make npm install a version are the ranges that match here, including the rule that keeps prereleases out of a range that names none. A range the page cannot read is refused with an example instead of being guessed at.

  1. Enter a complete three-part version, such as 2.4.1, 1.0.0-rc.1 or 2.4.1-beta.2+build.19. A version with a missing part, a leading zero or a numeric field above 9007199254740991 is refused, the way npm refuses it.
  2. Enter the range in the second field: an exact version, a comparator (>, >=, <, <=, =), a caret, a tilde (also written ~>), an open range such as 1.x or 1.2.x, a hyphen range such as 1.2.3 - 2.0.0, or a combination separated by spaces or by ||.
  3. Leave the range empty to read the version report on its own, or press Load example for the prerelease 2.4.1-beta.2+build.19 tested against ^2.4.0 || ~3.1.0.
  4. Read the range line and the note below it: when a prerelease fails only because the range names no prerelease on the same major.minor.patch, the page says so instead of answering does not match alone.
  5. Copy or download the report, and press Clear to reset both fields.

The range grammar, npm's prerelease rule and the limits of this page

What the range grammar covers

1.2.3 and v1.2.3 name a single release; >, >=, <, <= and = compare against it, and a space after the operator is allowed (>= 1.2.3). Two comparators in one field must both hold (>=1.2.3 <2.0.0), while || is satisfied by either side. ^1.2.3 accepts 1.2.3 up to 2.0.0, ~1.2.3 accepts 1.2.3 up to 1.3.0, and an open part is an interval: 1.2 means 1.2.0 up to 1.3.0, 1.x means 1.0.0 up to 2.0.0, and * accepts every version that carries no prerelease.

Prereleases and build metadata

A prerelease version only matches when the range names a prerelease on the same major.minor.patch: ^2.4.0 does not match 2.4.1-beta.2, ^2.4.0-beta.1 does match 2.4.0-beta.2, and * does not match 1.2.3-beta at all. Build metadata is ignored when versions are compared, so 2.4.1+build.19 matches 2.4.1, and a prerelease identifier may not start with a zero (1.2.3-01 is invalid): the rules npm applies are the rules applied here.

What this page does not do

There is no registry lookup, so the page cannot say which versions a package has published, whether a version exists, or what npm would install. A dist-tag such as latest is not a range, and the page answers that instead of guessing. The verdict covers the one version you typed: nothing is fetched, cached or sent anywhere.

Recent tools: