Semantic version compare and range checker
Sort and validate SemVer 2.0.0 versions, test them against npm ranges such as ^1.2.3 or ~1.4 with the reason, and bump them.
A clear answer. Here’s how.
Validates each version against the SemVer 2.0.0 grammar (semver.org items 2, 9 and 10: three numbers without leading zeros, optional dot-separated pre-release and build identifiers of 0–9, A–Z, a–z and hyphen) and sorts by precedence (item 11): major, minor and patch numerically; a pre-release before its normal version; pre-release identifiers left to right, numbers numerically and before text, text in ASCII order, and a longer list after a shorter equal prefix; build metadata ignored. Ranges follow the node-semver README that npm uses: comparators joined by spaces must all hold, sets joined by || are alternatives, and ^, ~, x-ranges, partial versions and hyphen ranges desugar exactly as its tables show (^1.2.3 is >=1.2.3 <2.0.0-0, ~1.2.3 is >=1.2.3 <1.3.0-0, ^0.0.3 is >=0.0.3 <0.0.4-0, 1.2.3 - 2.3.4 is >=1.2.3 <=2.3.4). A pre-release version satisfies a set only if some comparator in it has the same major.minor.patch and a pre-release tag, unless pre-releases are included. Each row gives the reason, and the desugared range is shown. Increments follow semver.inc, including premajor, preminor, prepatch and prerelease with an identifier. Loose parsing, Cargo, Composer or Maven range dialects and the intersects and subset functions are not offered.
How this is checked
5 reference checks passed These 5 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Versions, one per line 1.0.0-rc.1 1.0.0-beta.11 1.0.0 1.0.0-alpha.beta 1.0.0-beta.2 1.0.0-alpha 1.0.0-beta 1.0.0-alpha.1npm-style range to test (optional)
- Expected, and what Toolmoz gave
- Sorted order expected 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0, Toolmoz 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0Valid versions expected 8, Toolmoz 8
- Where the expected answer comes from
- semver.org item 11 example, ascending order: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-alpha.beta, 1.0.0-beta, 1.0.0-beta.2, 1.0.0-beta.11, 1.0.0-rc.1, 1.0.0
- Allowed difference
- exact
Case 2
- Inputs
- Versions, one per line 1.2.3 2.0.0npm-style range to test (optional) ^1.2.3
- Expected, and what Toolmoz gave
- Range means expected >=1.2.3 <2.0.0-0, Toolmoz >=1.2.3 <2.0.0-0Versions satisfying the range expected 1, Toolmoz 1
- Where the expected answer comes from
- node-semver README, caret ranges: ^1.2.3 means at least 1.2.3 and below 2.0.0-0, so 1.2.3 satisfies and 2.0.0 does not
- Allowed difference
- exact
Case 3
- Inputs
- Versions, one per line 0.0.3 0.0.4npm-style range to test (optional) ^0.0.3
- Expected, and what Toolmoz gave
- Range means expected >=0.0.3 <0.0.4-0, Toolmoz >=0.0.3 <0.0.4-0Highest satisfying version expected 0.0.3, Toolmoz 0.0.3
- Where the expected answer comes from
- node-semver README, caret ranges: ^0.0.3 means at least 0.0.3 and below 0.0.4-0
- Allowed difference
- exact
Case 4
- Inputs
- Versions, one per line 2.3.4 2.3.5npm-style range to test (optional) 1.2.3 - 2.3.4
- Expected, and what Toolmoz gave
- Range means expected >=1.2.3 <=2.3.4, Toolmoz >=1.2.3 <=2.3.4Highest satisfying version expected 2.3.4, Toolmoz 2.3.4
- Where the expected answer comes from
- node-semver README, hyphen ranges: 1.2.3 - 2.3.4 means at least 1.2.3 and at most 2.3.4
- Allowed difference
- exact
Case 5
- Inputs
- Versions, one per line 1.2.3-alpha.7 3.4.5-alpha.9 3.4.5npm-style range to test (optional) >1.2.3-alpha.3
- Expected, and what Toolmoz gave
- Versions satisfying the range expected 2, Toolmoz 2Highest satisfying version expected 3.4.5, Toolmoz 3.4.5
- Where the expected answer comes from
- node-semver README, prerelease tags: the range above 1.2.3-alpha.3 matches 1.2.3-alpha.7 and 3.4.5 but not 3.4.5-alpha.9
- Allowed difference
- exact
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Versions, one per line
1.0.0-beta.11 1.0.0 1.0.0-alpha.beta 2.0.0 1.0.0-rc.1 1.0.0-alpha 1.2.4-beta.1 1.0.0-beta.2 1.0.0-alpha.1 1.0.0-beta 01.2.3
- npm-style range to test (optional)
- ^1.0.0-beta.2
- Pre-releases in ranges
- Only when the range names the same major.minor.patch with a pre-release (npm default)
- Increment each version
- No
- Pre-release identifier for increments (optional)
Example result
| # | Version | Valid | Satisfies range | Why |
|---|---|---|---|---|
| 1 | 1.0.0-alpha | Valid | No | fails >=1.0.0-beta.2 in “>=1.0.0-beta.2 <2.0.0-0” |
| 2 | 1.0.0-alpha.1 | Valid | No | fails >=1.0.0-beta.2 in “>=1.0.0-beta.2 <2.0.0-0” |
| 3 | 1.0.0-alpha.beta | Valid | No | fails >=1.0.0-beta.2 in “>=1.0.0-beta.2 <2.0.0-0” |
| 4 | 1.0.0-beta | Valid | No | fails >=1.0.0-beta.2 in “>=1.0.0-beta.2 <2.0.0-0” |
| 5 | 1.0.0-beta.2 | Valid | Yes | satisfies “>=1.0.0-beta.2 <2.0.0-0” (pre-release allowed by >=1.0.0-beta.2) |
Precedence follows semver.org item 11: numbers compare numerically, a pre-release sorts before its release, numeric identifiers sort before text, and build metadata (+…) is ignored, so versions differing only in build are shown with =. Ranges follow npm (node-semver): a pre-release satisfies a range only when a comparator in the same set has the same major.minor.patch with a pre-release tag, unless pre-releases are included. A leading v is accepted, as npm does. Increments follow npm version / semver.inc.