Developer formats
Semantic Versioning: Valid SemVer Examples
Understand valid semantic version numbers, prerelease labels and build metadata with examples you can check against SemVer 2.0.0.
A semantic version has MAJOR.MINOR.PATCH numeric parts, such as 2.4.1. A prerelease follows a hyphen and build metadata follows a plus sign. The core numbers cannot contain leading zeros unless the number is zero.
The required SemVer structure
A semantic version has MAJOR.MINOR.PATCH numeric parts, such as 2.4.1. A prerelease follows a hyphen and build metadata follows a plus sign. The core numbers cannot contain leading zeros unless the number is zero.
Valid and invalid examples
| Version | Valid? | Reason |
|---|---|---|
1.0.0 | Yes | Complete core version |
2.1.0-beta.2 | Yes | Valid prerelease identifiers |
1.0.0+build.45 | Yes | Valid build metadata |
1.02.3 | No | Leading zero in minor |
v1.2.3 | No | Prefix is outside strict SemVer |
How precedence works
Compare major, minor and patch numerically. A prerelease has lower precedence than the associated normal release, so 1.0.0-rc.1 comes before 1.0.0. Build metadata does not affect precedence.
Validation versus release policy
A string can be valid SemVer without accurately describing compatibility. Teams still need rules for when breaking, additive and corrective changes increase major, minor or patch numbers.
When to increment each number
Increase MAJOR for incompatible public API changes, MINOR for backward-compatible functionality and PATCH for compatible fixes. Reset numbers to the right: after 2.7.4, a breaking release becomes 3.0.0.
SemVer begins with a declared public API. Validate syntax automatically, then review the number against release notes; a parser cannot decide whether a code change breaks compatibility.
Quick answers
Frequently asked questions
Is v1.2.3 valid SemVer?
Not under the strict grammar. Some tools accept v as a convenience prefix.
Is 1.0 valid?
No. Semantic Versioning requires major, minor and patch components.
Does build metadata change sorting?
No. Versions that differ only by build metadata have equal precedence.
Can prerelease labels contain uppercase letters?
Yes. ASCII letters, digits and hyphens are allowed, though identifiers are case-sensitive.
Continue with a tool