Skip to content
OddsockLocal
Local
Source text

The preview shows up here.

ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Paste one version, including any -prerelease and +build.
  2. Read major, minor and patch.
  3. Read prerelease identifiers in order. Numbers are numbers.
  4. Read build metadata separately. It is not used when two versions are compared.

What is SemVer parser?

The parser only splits. Paste 2.1.0-alpha.2+b7 and you get major 2, minor 1, patch 0, prerelease alpha then the number 2, and build b7. Numeric prerelease identifiers stay numbers, which matters because SemVer compares 2 as a number and beta as text. Build metadata is reported and, by the spec, ignored when versions are ordered.

Read more

There is no bump and no range field on this page. If you need 1.2.3 to become 1.3.0, or you need to know whether a version satisfies ^1.0, that is the calculator. An unparseable string fails with “Invalid semantic version” rather than a partial object.

The build section after + can hold several dot-separated pieces. The prerelease section after - works the same way. A plain 1.2.3 comes back with empty prerelease and build arrays. Leading zeros and missing parts fail, because those are not semantic versions.

Use cases

  • A release note says 2.1.0-alpha.2+b7 and you need the prerelease identifiers separated from the build metadata.
  • A script author wants to see that the 2 in alpha.2 is a number, not the string "2", before writing a comparator.
  • You are checking a tag that might be v1.2.3 or 1.2 and you want the invalid forms rejected.
  • Build metadata should be visible for humans and ignored for ordering, and you want those parts labeled.

Prerelease identifiers and build metadata

2.1.0-alpha.2+b7

major 2, minor 1, patch 0, prerelease ["alpha", 2], build ["b7"].

Why use Oddsock

The number 2 stays a number. String sorting would put alpha.10 before alpha.2, and SemVer does not.

Related tools

Using this tool

SemVer treats numeric prerelease identifiers as numbers, so alpha.2 is less than alpha.10. A string sort would get that backwards. The JSON keeps the type.