Guide
About this semver comparator
The SemVer comparator parses version strings according to Semantic Versioning 2.0.0 and compares them by precedence. It handles release, prerelease, and build metadata for two-version comparisons and batch sorting of version lists. All parsing and comparison run in your browser.
How to use the semver comparator
- 1.Enter two version strings (a leading "v" is optional) for a pairwise comparison.
- 2.Inspect the parsed major.minor.patch, prerelease, and build fields for each version.
- 3.For batch sorting, paste one version per line and review the sorted output.
- 4.Invalid lines are reported separately so you can fix them and re-run the sort.
Important details
Precedence follows SemVer 2.0.0 §11
Major, minor, and patch are compared numerically. A prerelease version has lower precedence than the same release. Prerelease identifiers are compared per-field: numeric identifiers are lower than alphanumeric identifiers, alphanumerics by ASCII sort, and a shorter prerelease list is lower when all shared identifiers are equal.
Build metadata is ignored for precedence
Identifiers after the plus sign — for example, 1.0.0+build.42 — are not used when comparing versions. Two versions that differ only in build metadata are considered equal for precedence purposes.
Frequently asked questions
Why does 1.0.0-alpha compare lower than 1.0.0?
Per SemVer 2.0.0, any prerelease version has lower precedence than its corresponding release. The prerelease identifier only adds qualification; it never raises precedence above the patch segment.
Is "v" required before the version number?
No. The comparator accepts an optional leading v or V, such as "v1.2.3", but the prefix is stripped before parsing — it is not part of the SemVer 2.0.0 BNF itself.
References: Semantic Versioning 2.0.0