Something wrong with this tool?

About Semver Compare Online

This tool compares two SemVer (Semantic Versioning) versions — like 1.2.3 vs 1.3.0-beta — and tells you which is newer, by how much, and what kind of change separates them (major, minor, patch, prerelease).

SemVer is the standard versioning scheme for libraries, packages, and APIs. It signals the impact of changes: major bumps break compatibility, minor adds features, patch fixes bugs, and prerelease tags mark unstable builds. Reading SemVer correctly is crucial when upgrading dependencies.

The tool follows the SemVer 2.0 spec exactly, including prerelease ordering rules. Useful when planning version upgrades, comparing release tags in CI/CD, or building dependency tools that need to evaluate version constraints.

How to use this tool

How to compare two SemVer versions

  1. Enter the two versions

    "Version A" and "Version B" each accept a SemVer string like `1.2.3`. Leading `v` is stripped, and missing patch defaults to 0 (so `1.2` parses as `1.2.0`). Pre-release/build metadata is ignored — only major/minor/patch are compared.

  2. Press Run

    Result returns a single `cmp` field — `-1` if A < B, `0` if equal, `1` if A > B. Comparison is component-wise: majors first, then minors, then patches.

  3. Examples

    `1.0.0` vs `1.0.1` → cmp -1. `2.0.0` vs `1.99.99` → cmp 1 (major wins). `1.2.3` vs `1.2.3-rc.1` → cmp 0 (pre-release ignored here, unlike full SemVer).

  4. Where this differs from real SemVer

    Strict SemVer (semver.org) treats `1.2.3` > `1.2.3-rc.1` because pre-release sorts lower than the release. This tool ignores everything after the patch — fine for sanity checks, but use a real semver library for npm's `^/~` range logic.