Semver Comparator
Compare and sort semver versions with prerelease/build metadata, and test ranges like ^ ~ >= — stop guessing dependency upgrades.
>_ USAGE GUIDE
Semantic versioning (semver.org) has more fine print than intuition suggests: prereleases sort below the release, dotted identifiers compare numerically when numeric, numeric identifiers sort below alphanumeric ones, and build metadata is ignored for precedence. This tool settles "is 1.2.3 newer than 1.3.0-rc.1?" and "which versions does ^1.2.3 actually allow?" strictly by the spec.
- Compare two versions: type them at the top and read the
<=>relation, with prerelease identifiers shown side by side - Sort a list: one version per line in the left panel (v-prefixes and prereleases welcome); output is ascending, with invalid lines sunk to the bottom and flagged
- Check a range: enter a version and a range such as
^1.2.3,~1.2.3,>=2.0.0or1.2.xfor an instant hit or miss - Inspect metadata: prerelease (compared) and build (ignored) are parsed separately — check here when two versions unexpectedly compare equal
>_ FAQ
Q1 · Does ^1.2.3 allow upgrading to 2.0.0?
No. ^1.2.3 means >=1.2.3 <2.0.0 — the major version is locked. Major 0 has special rules (unstable by definition): ^0.2.3 locks the minor (>=0.2.3 <0.3.0) and ^0.0.3 matches exactly 0.0.3. The more conservative ~1.2.3 locks the minor: >=1.2.3 <1.3.0.
Q2 · How do 1.0.0-alpha, 1.0.0-alpha.1 and 1.0.0-beta sort?
Ascending: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-beta < 1.0.0. A prerelease sorts below the release; dotted identifiers are compared segment by segment, numerically when both are numeric; a numeric segment sorts below an alphanumeric one (so alpha.1 > alpha); with equal prefixes, the longer identifier set is larger.
Q3 · Does build metadata (+build.5) affect comparison?
No. 1.2.3+build.1 and 1.2.3+build.9 are equal by semver precedence — build metadata is informational only. The tool shows the build field separately, which is handy in CI: use it to tell artifacts apart while comparing versions without it.
Q4 · Is the v in v1.2.3 valid?
Input accepts it: the v prefix (a Git tag convention) is stripped before parsing. Keep in mind that the semver grammar itself has no v prefix, so bare versions belong in semantic fields like package.json.
Q5 · Why is 01.2.3 invalid?
The spec forbids leading zeros (01, 1.02 are both invalid) to avoid confusion with octal literals. The tool refuses to guess and the sort panel flags such lines with # ✗ at the bottom, making dirty data easy to spot.