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.

INPUT06GUIDEDeveloper formats
Plain Tools original diagram: developer formats from input to checked result.

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

VersionValid?Reason
1.0.0YesComplete core version
2.1.0-beta.2YesValid prerelease identifiers
1.0.0+build.45YesValid build metadata
1.02.3NoLeading zero in minor
v1.2.3NoPrefix 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

Put this guide into practice

Semantic version checkerValidate a SemVer string →Format checkerCompare strict formatting rules →Sort linesOrder a list of versions for review →Regex syntax checkerCheck a related pattern language →