Works on this device
Semantic Version Checker
Type a version such as 1.4.0-rc.1+build.7 to see whether it follows Semantic Versioning 2.0.0, what its parts are, and what the next versions are. You can also compare two versions and test versions against an npm range such as ^1.2.3.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your check will show here
Type a version, such as 1.4.0-rc.1.
Version check
How it was worked out
How to use the checker
- Choose what you want to check: one or more versions, two versions to compare, or versions against a range.
- Type the versions, one on each line, or a range such as
^1.2.3or>=1.0.0 <2.0.0. - Choose Check. The result says what is valid and why, and the table shows each version.
The rules of Semantic Versioning 2.0.0
- A version is MAJOR.MINOR.PATCH: three whole numbers with no leading zeros, such as
2.10.0.2.01.0and2.1are not valid. - A pre-release follows a hyphen:
1.0.0-alpha,1.0.0-rc.1. Its identifiers, separated by dots, use A to Z, a to z, 0 to 9 and the hyphen. They are not empty, and a number has no leading zero. - Build metadata follows a plus sign:
1.0.0+20130313144700. It uses the same characters, and leading zeros are allowed. It does not count for precedence. - A leading
v, as inv1.2.3, is common in tags but is not part of a semantic version. - Next versions: PATCH + 1 for fixes that keep compatibility, MINOR + 1 (PATCH back to 0) for new features that keep compatibility, MAJOR + 1 (MINOR and PATCH back to 0) for changes that break compatibility.
- MAJOR 0 (0.y.z) is for first development: anything may change at any time.
Precedence
MAJOR, MINOR and PATCH are compared as numbers. A pre-release comes before its normal version. Pre-release identifiers are compared one by one: numbers by value, text in ASCII order, a number before text, and with all shared identifiers equal the longer list comes later. The specification gives this order:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
npm ranges (node-semver)
^1.2.3means>=1.2.3 <2.0.0-0: changes that keep the first number that is not zero.^0.2.3means>=0.2.3 <0.3.0-0, and^0.0.3means>=0.0.3 <0.0.4-0.~1.2.3means>=1.2.3 <1.3.0-0: PATCH changes only.~1means>=1.0.0 <2.0.0-0.1.x,1.*and1mean every 1.y.z version;1.2means every 1.2.z version;*means any version.1.2.3 - 2.3.4means>=1.2.3 <=2.3.4. A partial end such as1.2.3 - 2.3means>=1.2.3 <2.4.0-0.- Comparators with a space between them must all hold;
||joins sets of which one must hold. - A pre-release version satisfies a range only when a comparator has a pre-release on the same MAJOR.MINOR.PATCH. So
1.5.0-rc.1does not satisfy^1.2.3, but1.2.4-betasatisfies>=1.2.4-alpha. - The
-0in<2.0.0-0means below every pre-release of 2.0.0, so2.0.0-betadoes not satisfy^1.2.3either.
Worked example
1.4.0-rc.1+build.7 is valid: MAJOR 1, MINOR 4, PATCH 0, pre-release rc.1, build metadata build.7. It is a pre-release of 1.4.0. The next versions are 1.4.1, 1.5.0 and 2.0.0.
Against ^1.2.3, the versions 1.2.3 and 1.9.0 satisfy the range; 2.0.0, 2.0.0-beta.1, 1.5.0-rc.1 and 1.2.2 do not.
Limits you should know
- Ranges are read by the documented rules of node-semver (npm) with its default settings: pre-releases are not included by the range unless a comparator names one, and the loose mode is not used.
- Other package managers read ranges in their own way (for example Python, Ruby, Cargo or Composer). Their rules are not used here.
- A pre-release on a version with x or missing parts, such as
1.2.x-beta, is not read. - To sort a list of versions or to compare other version schemes, use the Version Comparator.