Semver Comparator and Range Explainer

Compare or sort semantic versions and inspect a plain explanation of the selected range shape.

On-device No sign-up Free to use

Compare versions controls

?

One version per line, such as 1.2.3. The lines are sorted and each one keeps its place in the order.

?

For example ^1.2.0, ~1.2.3, >=1.2 <2.0.0 or 1.x. Leave it empty to see the order only.

?

Off by default under npm range-matching rules: a prerelease is only in range when the range itself names a prerelease with the same major, minor and patch. SemVer defines version precedence separately.

Processed in your browser. Your inputs stay on this device.

Showing an example. Change the fields, then use compare versions to update it.

Result

Showing an example.

Sort two stable versions and a release candidate by semantic-version precedence.

Compared and sorted 3 versions. The lowest is 1.2.3 and the highest is 2.0.0-rc.1.

Loading the tool. Your result will appear here.

https://usefreetools.net/semver-comparator · 20 November 2026

Was this helpful?

How to use Semver Comparator and Range Explainer

  1. List two to 200 versions, one per line, including major, minor and patch. Blank lines are ignored.
  2. 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.
  3. Choose whether to relax npm’s usual prerelease exclusion. Allowing prereleases does not remove the range’s numeric bounds.
  4. 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.

You add
Versions to compare: 1.2.3 1.10.0 2.0.0-rc.1; Let prereleases match the range: false
You get
Compared and sorted 3 versions. The lowest is 1.2.3 and the highest is 2.0.0-rc.1.

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.

Page updated · Project managed by Tony Hines · Report a problem with Semver Comparator and Range Explainer