go-supertools
Developer & Data Tools

Semver Range Tester

Test versions against npm-style semver ranges like ^1.2.0, ~1.4 or >=2 <3.

Runs in your browser Your input never leaves your device.

0 characters | 0 words
—

Report a problem with this tool

About this tool

Semantic versions look like 1.4.2 or 2.0.0-beta.1, and package managers describe the versions they accept with ranges: ^1.2.0 (compatible with 1.2.0, so 1.x from 1.2.0), ~1.2.0 (patch updates only), >=1.0.0 <2.0.0, 1.x, 1.2.3 - 2.3.4, and combinations with || (or). Enter a range, then versions one per line, and the tool shows which of them match, the lowest version the range allows, and the highest of your versions that fits. Each version is broken into major, minor, patch, pre-release and build parts. Pre-release versions follow the npm rule: 1.5.0-beta.1 does not match ^1.2.0 unless the range itself names a pre-release of the same x.y.z, or you tick Include pre-releases. The engine is the same semver library that npm uses, and we compared 936 range and version combinations with Python's semantic_version, which implements the npm rules, with identical answers. Loose parsing turns on npm's lenient rules, which accept some malformed versions, such as leading zeros (1.02.3) or a stray = sign; it does not make a shortened version like 1.2 valid. Everything runs in your browser; nothing is uploaded.

How to use it

  1. Type a range, such as ^1.2.0.
  2. Enter the versions to test, one per line.
  3. Read which match, and the lowest and highest.
  4. Tick Include pre-releases if you want them to match.

Common problems

A pre-release version does not match
By the npm rules a pre-release only matches a range that mentions a pre-release with the same major, minor and patch. Tick Include pre-releases to relax that.
It says the version is not valid
A semantic version needs three numbers: 1.2.3. A leading v is accepted. Use Loose parsing for 1.2.
^0.2.3 does not allow 0.3.0
For versions below 1.0, the caret treats the first non-zero part as the breaking one, so ^0.2.3 means 0.2.x from 0.2.3 only.