SemVer Validator
DataValidate semantic version strings against the SemVer 2.0.0 spec instantly. Checks MAJOR.MINOR.PATCH, pre-release identifiers, and build metadata — client-side only.
What is a SemVer?
The SemVer Validator checks whether a version string conforms to the Semantic Versioning 2.0.0 specification — the standard versioning scheme used by npm, Cargo, Helm, Composer, and most modern package managers and release pipelines.
A valid SemVer string follows the pattern MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA], where:
- MAJOR — incremented for breaking, backward-incompatible API changes
- MINOR — incremented for new backward-compatible functionality
- PATCH — incremented for backward-compatible bug fixes
- Pre-release (optional) — appended after
-:1.0.0-alpha,2.3.0-rc.1 - Build metadata (optional) — appended after
+:1.0.0+build.20241231
Each of MAJOR, MINOR, and PATCH must be a non-negative integer with no leading zeros — 01.0.0 and 1.00.0 are structurally invalid under the spec. This rule is the most frequent source of format violations in auto-generated version strings from build pipelines.
The validator detects: missing components (1.0 → needs 1.0.0), leading zeros, invalid pre-release or build metadata identifiers, and the presence of a v prefix (which git tags use but SemVer itself does not include). A lenient mode strips the v before validating, for teams that store versions as git tag names.
Use the Regex Validator if you need to test a custom version pattern that deviates from SemVer. For UUID format validation, which follows a similarly strict structure, see the UUID Validator.
All validation runs client-side. Your version strings are never sent to any server or stored in any form.
How to use this SemVer calculator
- Type or paste your version string into the "Version String" input field. Examples:
1.0.0,2.3.4-alpha.1,1.0.0-beta+exp.sha.5114f85. - Select the v-prefix handling mode — "Strict" (default) rejects any string starting with
vorV; "Lenient" strips the prefix before validating, for git tag-style versions likev1.2.3. - Check the Valid/Invalid badge — it updates instantly as you type. A green "Valid" badge means the string conforms to SemVer 2.0.0.
- Read the details panel — on success, the parsed components (MAJOR, MINOR, PATCH, pre-release, build) are listed; on failure, the specific rule violations are enumerated.
- Fix violations based on the details — leading zeros are the most common fix (remove the zero); missing PATCH is the second most common (add
.0to complete the triple). - Re-validate after correcting the string — confirm all details lines show parsed components, not error hints.
Formula & Methodology
SemVer 2.0.0 format rule:version ::= MAJOR "." MINOR "." PATCH ["-" prerelease] ["+" buildmeta] MAJOR ::= numeric-identifier MINOR ::= numeric-identifier PATCH ::= numeric-identifier numeric-identifier ::= "0" | positive-digit | positive-digit digits positive-digit ::= "1"-"9" digits ::= digit | digits digit prerelease ::= dot-separated-pr-identifiers buildmeta ::= dot-separated-build-identifiersKey invariants enforced: - MAJOR, MINOR, PATCH must be non-negative integers — no leading zeros except for the bare value0- Pre-release identifiers may be numeric (no leading zeros) or alphanumeric+hyphen - Build metadata identifiers may contain alphanumerics and hyphens (leading zeros permitted here per spec) - Empty identifiers (e.g.1.0.0-or1.0.0+) are invalid Official regex (SemVer 2.0.0):^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*) (?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*) (?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))? (?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$Valid and invalid examples: | Version string | Valid? | Note | |---|---|---| |1.0.0| ✓ | Canonical form | |0.0.1| ✓ | Early development | |1.2.3-alpha.1| ✓ | Pre-release | |1.0.0-beta+exp.sha.abc| ✓ | Pre-release + build metadata | |1.0| ✗ | Missing PATCH component | |01.0.0| ✗ | Leading zero in MAJOR | |1.0.0.0| ✗ | Four components — SemVer has exactly three | |v1.0.0| ✗ strict / ✓ lenient |vprefix is a git convention, not SemVer | |1.0.0-| ✗ | Empty pre-release identifier | Use the UUID Validator for RFC 4122 UUID format validation, which follows a similarly strict structural specification.
Frequently Asked Questions