Semantic version sorter

Sort strict SemVer versions by release and prerelease precedence and reject malformed versions.

The example value has been entered. Check it immediately or change the value.

Input is processed in the browser. Refreshing returns a sample value.

Result

Instructions and example

No. Numeric identifiers compare numerically, so beta.2 comes first. Numeric identifiers have lower precedence than nonnumeric identifiers.

The example sorts as 1.0.0-beta.2 → 1.0.0-rc.1 → 1.0.0 → 2.0.0. A release follows prereleases with the same core version.

Build metadata does not affect precedence. Numeric prerelease identifiers cannot have leading 0s.

Frequently asked questions

Does beta.10 sort before beta.2?

No. Numeric identifiers compare numerically, so beta.2 comes first. Numeric identifiers have lower precedence than nonnumeric identifiers.

How do build metadata and leading 0s affect sorting?

Build metadata does not affect precedence. Numeric prerelease identifiers cannot have leading 0s.

Calculation criteria and reference materials

Verification of calculation criteria: · Calculation·verification principles · Report errors