How to use Semver Comparator and Range Explainer
- List two to 200 versions, one per line, including major, minor and patch. Blank lines are ignored.
- Optionally enter an npm-style range such as ^1.2.0, ~1.2.3 or 1.x || >=3. Leave it empty to compare ordering alone.
- Choose whether to relax npm’s usual prerelease exclusion. Allowing prereleases does not remove the range’s numeric bounds.
- Select Compare versions. Read the ascending order, separate prerelease/build columns, and the per-version range result and reason.
Example: Semver Comparator and Range Explainer
Sort two stable versions and a release candidate by semantic-version precedence.
Options
- Comparator sets
- Within a set, all comparators must match. Sets separated by || are alternatives: one matching set is enough. The displayed normalized comparators show how npm-style range shorthand is interpreted.
- Prerelease matching
- The checkbox is off by default. npm-style matching then excludes a prerelease unless a comparator in the matching set names a prerelease with the same major, minor and patch. Turning it on relaxes that exclusion; the version must still satisfy the bounds. This range policy is separate from SemVer ordering.
- Caret and tilde ranges
- For ^1.2.3, the upper boundary is 2.0.0; for ^0.2.3 it is 0.3.0. Tilde ~1.2.3 permits patch changes below 1.3.0, while ~1 permits later 1.x versions. Read the normalized comparator set and prerelease result for the exact boundary behavior.
- Build metadata
- A suffix such as +build.2 is displayed separately and does not change ordering. Two inputs can have equal precedence even when their build metadata differs.
Supported inputs and limits
- Compare 2 to 200 versions within 5,000 lines and 200,000 input characters.
- A malformed nonblank line is refused and identified by its line number.
- Optional ranges are limited to 200 characters.
- The parser and matcher use the local semver implementation: SemVer rules determine precedence, while npm-style range syntax determines membership.
- Range matching does not establish that a release exists, is published or works with your code.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Reading a range as sets rather than one line
A range with || is a list of alternatives. Each alternative is a group of comparators that must all hold, and the groups themselves are tried one after another. Keeping the groups separate is what makes 1.x || >=3 readable, because a version only has to satisfy one group rather than every comparator in the line.
Questions about Semver Comparator and Range Explainer
Why is a release candidate lower than the release?
SemVer orders 1.0.0-rc.1 below 1.0.0. Separately, npm-style ranges usually exclude prereleases unless a matching comparator set explicitly opts into the same major/minor/patch prerelease series, or you enable the checkbox.
Why is 1.10.0 above 1.9.0?
Each part is compared as a number rather than as text, so the minor version 10 is above the minor version 9. Text sorting would put 1.10.0 first, which is the mistake this comparison avoids.
Is a two-part version such as 1.2 accepted?
No. A semantic version needs major, minor and patch, so 1.2 is reported by its line number and the message says what a version looks like.
What does the -0 in an upper bound mean?
In a normalized bound such as <2.0.0-0, the -0 sits below later 2.0.0 prerelease labels. It helps keep those prereleases outside a range ending before the next major version. Use each row’s result to check the full comparator and prerelease policy.