Skip to main content

SemVer Version Calculator

Validate, compare, increment, range-test, and sort Semantic Versioning (SemVer 2.0.0) version strings. Handles prerelease precedence, build metadata, and npm-style ranges (^, ~, x, hyphen, ||).

Input

Pick the SemVer operation. The fields below adjust automatically.

Strict SemVer 2.0.0 syntax — major.minor.patch[-prerelease][+build].

Compared against Version A with strict SemVer precedence.

Output

Details
Was this helpful?

Guides

The SemVer Version Calculator is a free, browser-based toolkit for working with Semantic Versioning (SemVer 2.0.0) version strings. Whether you need to check that a version is valid, decide which of two releases is newer, figure out the next version to publish, test a version against an npm-style range, or sort a messy list of versions into precedence order, this tool does it instantly and entirely in your browser — nothing is uploaded to a server.

What it does

Pick an Operation and the form adjusts to show only the fields you need:

  • Validate version — parses a single version string and confirms it follows the strict MAJOR.MINOR.PATCH[-prerelease][+build] grammar, then breaks it into its components.
  • Compare two versions — reports whether Version A is older, newer, or equal to Version B using full SemVer precedence rules (including prerelease ordering).
  • Test version against range — checks whether a version satisfies an npm/composer-style range and shows the normalized comparator set it expands to.
  • Increment version — bumps a version by major, minor, patch, or any of the pre-* variants, with an optional prerelease identifier such as alpha, beta, or rc.
  • Sort multiple versions — orders a list of versions (one per line) ascending or descending, and separates out any invalid lines.

How to use it

  1. Choose the Operation from the dropdown.
  2. Fill in the version, range, or list the operation asks for. A leading v (as in v1.2.3) is accepted and stripped automatically.
  3. Read the one-line Summary and the full Details breakdown. Copy or download the result with the buttons on the output.

Because the tool runs client-side, it updates as you type — there is no "calculate" button and no request leaves your machine.

What counts as a valid version?

A valid SemVer string is three non-negative integers separated by dots, optionally followed by a hyphen-delimited prerelease and a plus-delimited build metadata section — for example 1.0.0, 2.3.4-rc.1, or 1.0.0-beta+exp.sha.5114f85. Numeric prerelease identifiers may not have leading zeros (1.0.0-01 is invalid), and build metadata is ignored when comparing precedence.

How is precedence determined?

Major, minor, and patch are compared numerically. A version with a prerelease tag always has lower precedence than the same version without one (1.0.0-rc.1 < 1.0.0). Prerelease identifiers are compared field by field: numeric identifiers sort numerically and always rank below alphanumeric ones, which sort in ASCII order. Build metadata never affects ordering.

Which range syntaxes are supported?

Caret (^1.2.0), tilde (~1.2), x-ranges (1.2.x, 1.*), hyphen ranges (1.2.0 - 2.0.0), the comparison operators (>, >=, <, <=, =), whitespace-joined AND-sets, and || for OR — the same conventions used by npm's semver package. Following that convention, a prerelease version only satisfies a range when a comparator pins the same major.minor.patch and itself includes a prerelease tag.

semversemantic versioningversionnpmcompare versions

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.