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.
| Range | Means |
|---|---|
| ^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 |
Yes. Any prerelease ranks below the release with the same numbers.
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.
Patch updates only: 1.2.3 up to, but not including, 1.3.0.
npm only matches prereleases when the range names a prerelease of the same version, so you don't get betas by accident.
No. 1.0.0+20240101 and 1.0.0+abc have the same precedence.
No. Everything runs in your browser.
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.