SemVer Comparator & Range Checker
Compare two semantic versions to see which is newer, or check whether a version satisfies an npm-style range like ^1.2.3 or >=1.0.0 <2.0.0.
Frequently Asked Questions
How are two semantic versions compared?
Major, minor and patch are compared numerically in that order, so 1.10.0 is newer than 1.9.0. If those are equal, a version with a pre-release (like 1.0.0-beta.1) ranks below the plain release (1.0.0). Build metadata after a + is never used for comparison.
How are pre-release identifiers ordered?
Dot-separated identifiers are compared left to right. Numeric identifiers compare as numbers, everything else compares as ASCII text, and a numeric identifier always ranks below an alphanumeric one. A version with more pre-release fields outranks one that is otherwise identical but has fewer, e.g. 1.0.0-alpha.1 > 1.0.0-alpha.
What does a caret range like ^1.2.3 mean?
It allows any change that does not touch the leftmost non-zero version component: ^1.2.3 means >=1.2.3 <2.0.0. Below 1.0.0 it is stricter, since minor versions can be breaking there: ^0.2.3 means >=0.2.3 <0.3.0, and ^0.0.3 means >=0.0.3 <0.0.4.
What does a tilde range like ~1.2.3 mean?
It allows patch-level changes: ~1.2.3 means >=1.2.3 <1.3.0. With no patch given, ~1.2 allows the same range; with only a major version, ~1 allows >=1.0.0 <2.0.0.
What range syntax is supported?
Comparators (=, >, >=, <, <=), space-separated comparator sets (AND), "||" between sets (OR), ~ and ^ shorthands, x-ranges like 1.2.x or 1.x, and inclusive hyphen ranges like 1.2.3 - 2.3.4 — the same syntax npm uses in package.json.
Is my data sent anywhere?
No, all parsing and comparison happens in your browser.