FormatterHQ

SemVer Checker & Range Tester

Paste a list of versions to validate and sort them by SemVer 2.0.0 rules, test them against an npm-style range like ^1.2.0, and compare two versions.

Input TEXT
Output TEXT
Ready.

How to use the SemVer Checker & Range Tester

  1. Paste versions separated by spaces, commas or new lines, for example 1.2.3 1.10.0 2.0.0-beta.2.
  2. Type an npm-style range in the Range box, such as ^1.2.0, ~2.3 or >=1.0 <2.
  3. Choose Oldest first or Newest first, and tick Include prereleases in ranges if beta versions should count.
  4. Click Sort & test range to see which versions match, or Compare first two to compare the first pair.

SemVer Calculator: Validate, Sort and Test Version Ranges

Version strings do not sort like text or decimals: 1.10.0 is newer than 1.9.0, and 2.0.0-beta.10 is newer than 2.0.0-beta.2. This semver calculator applies the Semantic Versioning 2.0.0 rules to sort a list correctly, flags invalid versions, and shows which ones satisfy an npm-style range, so you can predict what npm install will pick before you change package.json.

What is semantic versioning?

A SemVer version is MAJOR.MINOR.PATCH, optionally followed by a prerelease tag (-beta.2) and build metadata (+build.5). You bump MAJOR for breaking changes, MINOR for new backward-compatible features and PATCH for fixes. The strict rules matter when parsing:

  • All three numbers are required, so 1.2 is not a valid version, although it is valid inside a range.
  • Numbers cannot have leading zeros: 01.2.3 is rejected.
  • A leading v is tolerated, as many Git tags use it.
  • A prerelease sorts before its release: 1.0.0-alpha < 1.0.0.
  • Numeric prerelease parts compare as numbers, and build metadata is ignored when comparing.

Example

With the range ^1.2.0:

Sorted (oldest first):
  0.9.9                   ✘ outside ^1.2.0
  1.0.0-alpha             ✘ outside ^1.2.0
  1.2.3                   ✔ satisfies ^1.2.0
  1.2.10                  ✔ satisfies ^1.2.0
  1.10.0                  ✔ satisfies ^1.2.0
  2.0.0-beta.2            ✘ outside ^1.2.0
  2.0.0-beta.10           ✘ outside ^1.2.0
  2.0.0                   ✘ outside ^1.2.0

Range ^1.2.0 → >=1.2.0 <2.0.0-0
Highest matching version: 1.10.0

Next versions after 2.0.0: patch 2.0.1 · minor 2.1.0 · major 3.0.0 · prerelease 2.0.1-0

The expanded range line shows exactly what the shorthand means, and "Highest matching version" is the one a package manager would install from that list. The last line suggests the next patch, minor, major and prerelease numbers after the newest version.

Range syntax explained

RangeMeans
^1.2.3>=1.2.3 <2.0.0-0: anything without a breaking change
^0.2.3>=0.2.3 <0.3.0-0: in 0.x, the minor version counts as breaking
~1.2.3>=1.2.3 <1.3.0-0: patch updates only
1.2.x or 1.2>=1.2.0 <1.3.0-0
1.2.3 - 2.3>=1.2.3 <2.4.0-0 (hyphen range)
1.x || >=3.0.0either set matches
*any release version

Prereleases and ranges

npm deliberately keeps betas out of ranges. A prerelease such as 1.3.0-beta.1 only satisfies a range if a comparator in the same set names a prerelease of the same major.minor.patch. So ^1.2.3-beta.1 matches 1.2.3-beta.2 but not 1.3.0-beta.1. Tick Include prereleases in ranges to drop that rule, which matches npm's includePrerelease option.

Common range mistakes

  • No upper bound. >=1.0 also accepts 2.0.0 and every future breaking release. Add <2 or use a caret.
  • Expecting a bare version to float. 1.2.3 matches exactly that version and nothing else. Use a lockfile, not exact pins, for reproducible installs.

Comparing two versions

Compare first two prints the relation between the first two valid versions and the level of difference, for example 2.0.0-beta.10 > 2.0.0-beta.2 with "Difference: prerelease". It is handy for deciding whether an upgrade is major, minor or a patch.

To read the dependencies block you are checking, open your package.json in the JSON validator. If you need a pattern that matches version strings in logs or CI scripts, build it in the regex tester.

Privacy

Parsing, sorting and range matching run in your browser. No registry is contacted and your version lists stay on your machine.

Frequently asked questions

What is the difference between ^ and ~ in package.json?
The caret (^1.2.3) accepts new minor and patch releases up to the next major version, while the tilde (~1.2.3) accepts only patch releases within 1.2. For 0.x versions the caret is stricter and behaves like the tilde, because minor bumps are treated as breaking.
Why does 1.10.0 sort after 1.9.0?
Each part of a semantic version is compared as a number, not as text. 10 is greater than 9, so 1.10.0 is newer. Plain alphabetical sorting would put 1.10.0 first, which is a common bug in scripts.
Why does ^2.0.0 not match 2.1.0-beta.1?
npm excludes prereleases from ranges unless the range itself mentions a prerelease with the same major, minor and patch numbers. This stops unstable versions from being installed by accident. Enable Include prereleases in ranges to test the looser behavior.
Is 1.2 a valid semantic version?
Not as a version: SemVer 2.0.0 requires all three numbers, so the tool lists it as invalid. Inside a range, however, 1.2 is a shorthand for 1.2.x and matches any 1.2 patch release.
Does build metadata affect version order?
No. Everything after a plus sign, such as +build.5 or +sha.abc123, is ignored when comparing, so 1.2.3+build.5 and 1.2.3 are equal in precedence.

Last updated October 3, 2026

Related tools

Checksum Calculator Calculate MD5, SHA-1, SHA-256, SHA-512, CRC-32 and more checksums of a file or text at once. Chmod Calculator Convert Linux file permissions between octal (755) and symbolic (rwxr-xr-x) with checkboxes, including setuid, setgid and sticky bits. CIDR / Subnet Calculator Calculate network, broadcast, netmask, wildcard, host range and host count for any IPv4 or IPv6 CIDR block. Date & Time Calculator Calculate the difference between two dates or add/subtract days, weeks, months and years from a date. Time Sheet Calculator Add up weekly work hours from start and end times with breaks. Calculates overtime per day or week and optional gross pay. Snowflake ID Decoder Convert Twitter/X, Discord, Instagram and other Snowflake IDs to timestamps and show worker, process and sequence bits. TOTP / 2FA Code Generator Generate live TOTP 2FA codes from a Base32 secret or otpauth:// URI, create new secrets and QR codes for authenticator apps. ULID Decoder Decode ULIDs to their embedded timestamp and random part, and convert between ULID and UUID formats. Un-Google Link Remove Google redirect wrappers (google.com/url, AMP, image results) and tracking parameters to get the real destination URL. Unix Timestamp Converter Convert Unix epoch timestamps to human dates and dates to timestamps, in UTC, local time and any time zone. URL Parser Break a URL into scheme, host, port, path, query parameters and fragment. Decodes values and parses many URLs at once. User Agent Parser Parse user agent strings to identify browser, version, rendering engine, operating system, device type and bots.