Open source

Semantic versioning explained: what 2.4.1 really means

Semantic versioning packs a promise into three numbers: major, minor and patch. Learn the rules, how version ranges like ^ and ~ work, and how to version your own project.

Cursorlane Editorial TeamSoftware & tools 5 min read
Three nested wooden boxes of decreasing size on a workbench beside a measuring tape and labels with no writing

Semantic versioning, often shortened to SemVer, is a widely used convention for version numbers in the form MAJOR.MINOR.PATCH, such as 2.4.1, where each number tells users what kind of change to expect. It lets people and tools decide whether an upgrade is safe without reading every line of the changelog.

This explainer covers the rules, what counts as a breaking change, pre-release labels, how dependency version ranges work, and how to apply SemVer to your own project.

What do the three numbers mean?

Each part of a semantic version has a specific meaning, defined in the public Semantic Versioning specification. When you release a new version, you increase exactly one part based on the biggest kind of change it contains, and reset the parts to its right to zero.

The point is communication. A user who sees a jump from 2.4.1 to 2.4.2 can expect bug fixes and nothing else. A jump to 2.5.0 means new features they can ignore if they like. A jump to 3.0.0 is a signal to read the release notes before upgrading, because some of their code may need to change.

  • MAJOR: incremented for incompatible, breaking changes to the public API. 2.4.1 becomes 3.0.0.
  • MINOR: incremented when you add functionality in a backwards-compatible way. 2.4.1 becomes 2.5.0.
  • PATCH: incremented for backwards-compatible bug fixes. 2.4.1 becomes 2.4.2.

What counts as a breaking change?

A breaking change is anything that could make correct code written against the previous version stop working. That includes removing or renaming a function, changing the type or order of its parameters, changing what it returns, making a previously optional argument required, or dropping support for a platform or language version.

SemVer only works if you define your public API: the functions, commands, configuration options or endpoints you promise to keep stable. Internal code can change freely. Bug fixes can be tricky: if many users rely on a buggy behaviour, fixing it may effectively break them, and some projects treat such fixes as major changes for safety.

Deprecation softens the blow. In a minor release, mark an old function as deprecated and add a warning, while keeping it working. Remove it in the next major release, so users have time to migrate.

A version number is a promise, and users notice quickly when a patch release breaks their code.

What does version 0.x mean?

Versions starting with 0, such as 0.7.3, signal initial development. Under the specification, anything may change at any time, and the public API should not be considered stable. Many projects use 0.x to experiment before committing to an API.

In practice, many tools treat a 0.x minor bump, such as 0.7 to 0.8, as potentially breaking. Releasing 1.0.0 is the moment you promise stability. If people already depend on your project in production, it is probably time for 1.0.0.

Staying on 0.x for years is common in some ecosystems, but it leaves users without a clear compatibility promise. If you find yourself carefully avoiding breaking changes anyway, your project is already behaving like 1.0, and the version number should say so.

How do pre-release and build labels work?

You can add a pre-release label after a hyphen, such as 3.0.0-alpha.1, 3.0.0-beta.2 or 3.0.0-rc.1 (release candidate). Pre-releases sort before the final version, so 3.0.0-rc.1 comes before 3.0.0, and tools do not install them unless you ask.

Build metadata can be added after a plus sign, such as 1.4.0+build.57 or 1.4.0+sha.5114f85. It is ignored when comparing versions. Projects use it to record build numbers or commit identifiers.

How do version ranges like ^ and ~ work?

Package managers let you specify a range of acceptable versions for a dependency, relying on SemVer to pick up fixes without breaking changes. The exact syntax varies between ecosystems, but two symbols from the JavaScript world are widely recognised:

Ranges are a trade-off. Wide ranges pick up security fixes automatically but risk surprises if a maintainer breaks the rules by mistake. Narrow ranges are predictable but leave you on old versions unless you update deliberately. Combining sensible ranges with a lock file and automated update alerts gives most teams the best of both.

  • Caret ^1.4.2: any version from 1.4.2 up to, but not including, 2.0.0. Accepts minor and patch updates.
  • Tilde ~1.4.2: any version from 1.4.2 up to, but not including, 1.5.0. Accepts patch updates only.
  • Exact 1.4.2: only that version.
  • Lock files record the exact versions actually installed, so every build uses the same ones.

How do you apply SemVer to your own project?

Start by documenting what your public API is, so you and your users agree on what is covered by the promise. Then follow a simple routine for each release:

  • List the changes since the last release.
  • If any break the public API, bump MAJOR.
  • Otherwise, if any add features, bump MINOR.
  • Otherwise, bump PATCH.
  • Update the changelog, grouping entries by Added, Changed, Deprecated, Removed, Fixed and Security.
  • Tag the release in Git, for example v2.5.0, and publish.

Is SemVer always the right choice?

SemVer suits libraries and tools that other code depends on, where compatibility matters most. It is less useful for end-user applications, websites and services that do not have a programmatic API. Some projects use calendar versioning (CalVer), with numbers based on release dates, which suits software released on a fixed schedule.

Whatever scheme you use, the key is consistency. A version number is a promise, and users notice quickly when a patch release breaks their code.

Frequently asked questions

What does a major version change mean?

+

A major version bump, such as 2.x to 3.0.0, signals breaking changes. Code written for the old version may need updating, so read the release notes or migration guide before upgrading.

Is it safe to install minor and patch updates?

+

Under SemVer they should be backwards compatible, so they are usually safe. Mistakes happen, so run your tests after updating and use lock files to control when updates happen.

Do version numbers have to go up by one?

+

Yes, each part increments by one and the parts to its right reset to zero. You do not skip numbers, and each number is compared as a whole number, so 1.10.0 is newer than 1.9.0.

Should I start my project at 0.1.0 or 1.0.0?

+

The SemVer specification suggests starting at 0.1.0 during initial development. Move to 1.0.0 once your public API is stable or people depend on it in production.

What is the difference between SemVer and CalVer?

+

SemVer numbers express compatibility: major, minor and patch changes. CalVer numbers express when a release was made, such as year and month. CalVer suits time-based releases; SemVer suits libraries with APIs.

What is a changelog?

+

A changelog is a file listing notable changes in each version, usually newest first. It helps users decide whether and how to upgrade.

Semantic versioning is three numbers and one promise. Define your public API, bump the right number for each release, keep a changelog, and your users can upgrade with confidence.

How we research: Guides are written from established sources and checked for accuracy. They are general information, not professional advice.

Written by

Cursorlane Editorial Team

Software & tools

Our writers are developers and heavy software users who test what they write about and update guides when the tools change.

More Stories

View all →