Skip to content
Utilerio

Semver Comparator

Compare two semantic versions or check whether a version satisfies a range.

1.2.3 is less than 1.3.0
Major
1 / 1
Minor
2 / 3
Patch
3 / 0
Prerelease
— / —

Was this tool useful?

About this tool

Semantic Versioning (semver) gives a version number — major.minor.patch, e.g. 2.4.1 — a precise meaning: a major bump can break compatibility, a minor bump adds functionality safely, and a patch fixes bugs without changing the API. Package managers like npm compare and constrain versions using this exact rule set.

This tool implements the comparison and the common range operators (>=, <=, ^, ~) so you can check, without installing anything, whether a version satisfies a dependency constraint.

How to use it

  1. In Compare mode, enter two versions to see which one is newer and how their major/minor/patch/prerelease parts differ.
  2. In Satisfies Range mode, enter a version and a range such as ^1.2.3 or >=1.2.0 <2.0.0 — space-separated comparators are AND'd, and "||" separates alternative ranges, the same convention npm's own semver package uses.

Examples

Caret range

Version: 1.4.0
Range: ^1.2.3
Satisfies — ^1.2.3 allows any 1.x.y at or above 1.2.3, but not 2.0.0.

Common problems

My range uses "1.2.x" or a hyphen range like "1.2.3 - 2.3.4" and this tool rejects it.
Those shorthand forms aren't implemented here — rewrite the range using explicit comparators, e.g. ">=1.2.3 <=2.3.4" instead of a hyphen range.

Frequently asked questions