Interested in sponsoring? Reach out to discuss placements.
Semver Calculator — Compare Version Numbers
Compare semver versions.
Last updated: August 2026
Quick reference
- What this calculator does
- Compare two semantic version strings (major.minor.patch) and see whether A is less than, equal to, or greater than B.
- How it works
- Enter Version A and Version B; the tool parses major.minor.patch and reports equality or ordering.
- Example
- 1.2.3 versus 1.3.0 shows A < B because patch 3 is less than minor bump 3.0.
- When to use it
- Release planning, dependency range sanity checks, and teaching semver without writing comparison scripts.
A < B
Guide
Introduction
Semantic versioning promises predictable comparisons: 1.2.3 versus 1.2.4 is straightforward, but 1.10.0 versus 1.9.0 trips string sorting ("1.10" < "1.9" lexicographically). Package managers implement semver correctly; humans eyeballing changelog tables do not. Release managers need quick answers — is 2.0.0-rc.1 newer than 1.99.99? Certoflow's calculator handles strict major.minor.patch numeric triples only, not pre-release or build metadata.
Certoflow's Semver Calculator compares two version strings and reports: equal, A less than B, A greater than B, or invalid format. Parsing requires leading ^\d+\.\d+\.\d+ — suffixes like -beta may parse only the numeric prefix depending on input. All logic runs locally. Use with JSON Formatter when reading package.json versions, Cron Description Generator for release schedule expressions, and documentation linking to npm semver spec for full pre-release rules this tool does not implement.
What this tool does
| Input | Behavior |
|---|---|
| Version A | Default 1.2.3 |
| Version B | Default 1.3.0 |
| Result | "Versions are equal", "A < B", "A > B", or "Invalid semver format" |
Comparison is numeric per component: major first, then minor, then patch. No support for caret ranges (^1.2.3), tilde (~1.2.3), or wildcard comparisons.
How it works
export function parseSemver(version: string): number[] | null {
const m = version.trim().match(/^(\d+)\.(\d+)\.(\d+)/);
if (!m) return null;
return [Number(m[1]), Number(m[2]), Number(m[3])];
}
export function compareSemver(a: string, b: string): -1 | 0 | 1 | null {
const pa = parseSemver(a);
const pb = parseSemver(b);
if (!pa || !pb) return null;
for (let i = 0; i < 3; i++) {
if (pa[i] < pb[i]) return -1;
if (pa[i] > pb[i]) return 1;
}
return 0;
}
Live comparison updates as you type. Invalid inputs — v1.2.3, 1.2, 1.2.3.4 leading quadruple — return null and display invalid message. 1.2.3-beta may match 1.2.3 prefix only because regex captures first three numeric segments.
Real-world examples
Dependency upgrade decisions
lodash 4.17.20 versus 4.17.21 — confirm patch bump is newer before merging Dependabot PR. Major jump 4.x to 5.x shows A < B for planning breaking change review.
Mobile app store versioning
iOS 2.10.0 versus 2.9.0 — demonstrate numeric minor comparison beats string sort in stakeholder meetings.
Internal library release cadence
Document that 1.0.0 equals 1.0.0 for duplicate tag detection before git tag push.
Teaching semver segments
Students enter wrong orders intentionally — 0.2.0 versus 0.10.0 — to internalize zero-padded numeric comparison.
CI version gate documentation
Write runbook: deploy only if bundle version A >= minimum B. Use calculator to verify edge cases like 10.0.0 versus 9.99.99.
Common mistakes
Expecting pre-release ordering. 1.0.0-alpha versus 1.0.0 is not fully handled — numeric prefix may compare equal incorrectly for suffixes. Use npm CLI for prerelease semantics.
Including v prefix. v1.2.3 fails parse — strip prefix manually.
Comparing build metadata. 1.0.0+build1 versus 1.0.0+build2 is outside tool scope.
Using string sort in scripts. Replicate this numeric comparison in code, not localeCompare.
Assuming two-segment versions valid. 1.2 returns invalid — semver requires three components in this tool.
Ignoring major zero semantics. 0.y.z is valid semver for initial development but comparison logic is still numeric.
Use cases
Release managers validating version ordering in changelogs.
Developers quick-checking Dependabot or Renovate bumps.
Educators teaching semver versus lexicographic sorting.
QA staff confirming deployed version meets minimum requirements.
Technical writers consistent version ordering in compatibility matrices.
Package authors sanity-checking tags before publish.
FAQ
What format is required?
major.minor.patch with numeric components — e.g., 1.2.3.
Does it support v1.2.3?
No leading v — remove before compare.
Are pre-release versions supported?
Not fully. Regex may read numeric prefix only; use npm semver for -alpha rules.
What does invalid format mean?
Either input failed ^\d+\.\d+\.\d+ parse at start of trimmed string.
Is comparison live?
Yes. Result updates as inputs change.
How is equality displayed?
"Versions are equal" when all three components match.
Can I compare more than two versions?
Compare pairwise — no multi-sort UI.
Offline use?
Yes, entirely client-side.
Relation to package.json?
Versions in JSON Formatter output can be copied here for comparison.
Does this validate semver spec completely?
No. It implements numeric triple comparison for common release versions.
Version ordering in the wild
Package ecosystems embed semver strings in filenames, Docker tags, and mobile bundle identifiers. When two teams report "we are on 1.9" versus "we are on 1.10," string sorting in spreadsheets ranks 1.9 above 1.10 because character-by-character comparison sees 9 greater than 1 in the minor position. Certoflow's numeric comparison avoids that trap by parsing each segment as an integer. Document this behavior in release notes when stakeholders without engineering backgrounds compare version columns exported from Jira or Excel — those tools often default to lexical sort unless configured for semantic versions.
Pre-release tags deserve explicit caution. A release candidate 2.0.0-rc.1 is not ordered relative to 2.0.0 by this calculator if the suffix prevents clean triple parsing. npm's semver package implements full spec ordering including prerelease and build metadata; use it in CI gates. Certoflow answers the narrower question: given two plain x.y.z triples, which is newer? That covers the majority of "did we bump patch correctly?" conversations during hotfix weeks when tags look like 1.4.2 and 1.4.3 without suffix noise.
Frequently Asked Questions
- Is data uploaded?
- No. All processing runs locally in your browser.
- Does this work offline?
- Yes, after the page loads.
People also use
Related tools that complement this workflow.
Password Generator
Create secure random passwords instantly.
Developer ToolsUUID Generator
Generate UUID v4 identifiers securely in the browser.
Developer ToolsSHA256 Generator
Hash text with SHA-256.
Developer ToolsJSON Formatter & Validator
Format and validate JSON with one click.
Developer ToolsBase64 Encode
Encode text to Base64 with UTF-8 support.
Interested in sponsoring? Reach out to discuss placements.