Skip to content
IT glossary
ProgrammingUpdated December 3, 2026

Semantic versioning

Семантическое версионирование

A set of rules for numbering software releases so users can tell whether an update fixes bugs, adds features without breaking existing code, or introduces changes they may need to adapt to.

Also known as: semver

What SemVer tells you

Semantic versioning (SemVer) gives release numbers a specific meaning. If you maintain a library, the number tells users what kind of change to expect before they upgrade. It doesn't measure the size of the release: a one-line change can require a major version bump, while a large internal rewrite might leave the public API unchanged.

SemVer requires a declared public API. That contract can include exported functions, accepted inputs, return values, and documented behavior. Whether a change is breaking depends on what users were promised, not just on whether the function signatures still match.

How to pick the next version

Once the public API is stable, starting at 1.0.0, read MAJOR.MINOR.PATCH like this:

  • MAJOR: Make a backward-incompatible change to the public API. Reset both minor and patch to zero.
  • MINOR: Add backward-compatible functionality to the public API or mark part of it as deprecated. Reset patch to zero.
  • PATCH: Release only backward-compatible bug fixes.

Versions in the 0.y.z series are for initial development; consumers should not assume the public API is stable. A hyphen introduces a pre-release label: 3.0.0-rc.1 ranks below 3.0.0. Build metadata such as +build.42 does not affect version precedence. Once a version has been released, its contents must not change; publish a new version instead of replacing the old one.

Example: a CSV library

Suppose 2.3.4 of a CSV library documents that readCsv() returns every field as a string. The next version depends on what ships:

  • 2.3.5: Fix the parser so it correctly reads commas inside quoted fields, as documented.
  • 2.4.0: Add an opt-in setting to convert numeric fields to numbers. Existing calls still return strings.
  • 3.0.0: Turn numeric conversion on by default. A caller that expects "0012" can now receive the number 12 instead. That's a breaking change even though the function is called the same way.

Dependencies and interview questions

Package managers often use SemVer numbers to resolve dependencies, but range syntax belongs to the package manager. For example, npm interprets ^2.3.4 as allowing stable versions from 2.3.4 up to, but not including, 3.0.0. A matching version is eligible for installation; it isn't proof that the update is free of regressions. Use release notes and tests to check the behavior your application relies on.

An interviewer might ask whether removing a deprecated function counts as a minor change. Announcing the deprecation calls for a minor bump, but removing the function from a stable public API calls for a major bump. The useful distinction is what existing callers can still do after each release.