# Semantic versioning

> A rule for version numbers like 2.4.1, so each part tells you how risky an update is.

- Level: Intermediate
- Topics: Software
- URL: https://tidbit.legios.com.ar/semantic-versioning/
- In Spanish: [Versionado semántico](https://tidbit.legios.com.ar/es/semantic-versioning/)

**Semantic versioning**, or **SemVer**, is a convention for numbering software releases as three numbers: `MAJOR.MINOR.PATCH`, for example `2.4.1`. Each number has a precise meaning, so anyone using the software can tell what kind of change a new version brings just by looking at which number went up. The rules are written at semver.org, first published by Tom Preston-Werner, one of GitHub's founders.

A **patch** bump, `2.4.1` to `2.4.2`, means bug fixes only: nothing new, nothing removed. A **minor** bump, to `2.5.0`, adds new features but keeps everything that worked before working the same way. A **major** bump, to `3.0.0`, means there are **breaking changes**: something was removed or behaves differently, and code that used the old version may need adjusting. Versions starting with `0.`, like `0.7.3`, signal early development, where anything may change.

This matters because modern software is built from hundreds of libraries, and keeping them updated by hand would be impossible. Package managers like npm or pip read these numbers to update safely: a rule like `^2.4.1` means "accept any 2.x version from 2.4.1 up, but not 3.0". It only works if authors follow the rules honestly, and in practice a minor update occasionally breaks something anyway, which is why projects also lock exact versions and run their tests after updating.

## An analogy

Like the labels on a building's renovation notices. "Painting the hallway" (patch), "adding a new elevator" (minor), "we are moving the entrance to the other street" (major): you instantly know which ones require you to change your routine.

## Keep in mind

- Three numbers: MAJOR.MINOR.PATCH.
- Patch fixes bugs, minor adds compatible features, major can break things.
- Versions below 1.0.0 promise no stability.
- Package managers rely on it to update dependencies automatically.

## Go deeper

- [Semantic Versioning 2.0.0 (official spec)](https://semver.org/)
- [Software versioning on Wikipedia](https://en.wikipedia.org/wiki/Software_versioning)

## Related terms

- [GitHub](https://tidbit.legios.com.ar/github/): A website where teams store their code with Git and work on it together.
- [Bug](https://tidbit.legios.com.ar/bug/): A mistake in software that makes it behave differently from what was intended.
- [Software library](https://tidbit.legios.com.ar/software-library/): Ready-made code for a common task that programmers plug into their own programs.
