SemVer Compare

Compare semantic versions the way package managers do. Enter two versions to see which is newer and whether the change is major, minor, patch or just a prerelease; check a version against an npm range like ^1.2.0 or >=2.1.0 <3; and paste a list to sort it correctly — so 1.10.0 comes after 1.9.0 and release candidates come before the release. It's free, runs in your browser, and nothing is sent anywhere.

npm range shorthands

RangeMeans
^1.2.3>=1.2.3 <2.0.0
^0.2.3>=0.2.3 <0.3.0
~1.2.3>=1.2.3 <1.3.0
1.x>=1.0.0 <2.0.0
1.2.3 - 2.3.4>=1.2.3 <=2.3.4

When to use it

  1. Check whether a dependency update is a breaking change.
  2. Test what a package.json range will actually install.
  3. Sort a list of release tags correctly.
  4. Settle whether 1.0.0-rc.1 or 1.0.0-beta.11 is newer.

How to Use

  1. Enter two versions to compare them.
  2. Enter an npm range to test version A against it.
  3. Paste a list of versions to sort them.

Features

  1. SemVer 2.0.0 parsing and precedence
  2. Major, minor, patch or prerelease difference
  3. npm range checking
  4. Correct prerelease handling
  5. List sorting
  6. 100% client-side

FAQs

Is 1.0.0-rc.1 lower than 1.0.0?

Yes. Any prerelease ranks below the release with the same numbers.

What does ^1.2.3 allow?

Anything from 1.2.3 up to, but not including, 2.0.0. For 0.x versions it's stricter: ^0.2.3 allows up to 0.3.0.

What does ~1.2.3 allow?

Patch updates only: 1.2.3 up to, but not including, 1.3.0.

Why doesn't ^1.2.0 match 1.3.0-beta?

npm only matches prereleases when the range names a prerelease of the same version, so you don't get betas by accident.

Does build metadata matter?

No. 1.0.0+20240101 and 1.0.0+abc have the same precedence.

Is anything uploaded?

No. Everything runs in your browser.

Technical Details

Versions are parsed with the official Semantic Versioning 2.0.0 grammar, so 1.2 or 01.2.3 are rejected rather than guessed at. Precedence follows section 11 of the specification: major, minor and patch are compared numerically; a version with a prerelease tag is lower than the same version without one; prerelease identifiers are compared one by one, numeric identifiers numerically and alphanumeric ones in ASCII order, with numeric ranking below alphanumeric and a shorter set below a longer one when all else is equal. That's what puts 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0. Build metadata after + is ignored for precedence. Ranges use npm syntax — caret, tilde, x-ranges, hyphen ranges, comparators and || alternatives — and follow npm's rule that a prerelease only satisfies a range that explicitly names a prerelease of the same major.minor.patch, so ^1.2.0 doesn't match 1.3.0-beta.1.

Developer Tools

Developer Tools

  • Bitwise Calculator
  • MIME Type Lookup
  • Luhn Validator
  • IBAN, ISBN & Barcode Validator
  • SSL Certificate Decoder
  • HAR File Viewer
  • OpenAPI & Swagger Viewer
  • Log Analyzer