# Version Pinning

> Asking for one set version of a package. Then it does not change by itself.

**Field:** Software Development  
**Category:** Editors & Tools  
**Also known as:** Pinned Version, Pin a Dependency, Exact Version

## Think of it like

It is like asking for the red cup, not just any cup. You get the same one each time.

## Definition

Version pinning means asking for one exact version of a package, not a range. Writing react 18.3.1 is a pin. Writing ^18.3.1 is a range, so any later 18 version may come in. A pin means nothing changes until you change it. The cost is that fixes do not arrive by themselves, so you update the pins by hand or with a bot.

## Example

A new version of a chart package broke Lucy's app overnight. She pins it to the last good version, and the app works again.

## Example code

```json
"dependencies": {
  "react": "18.3.1",
  "lodash": "^4.17.21"
}
```

React is pinned to one version. Lodash takes a range, so newer 4.x fixes may come in.

## Why it matters

It keeps a working app working. A surprise update can no longer break it while you sleep.

## Common mistake

Pinning all of it and never updating. Old versions keep their known holes, so plan to move the pins.

## Three principles

- **Exact, not a range.** One version and no other.
- **Stable.** Nothing changes until you change it.
- **Update on purpose.** Move the pins on a schedule.

## Related terms

- [Lockfile](https://learn.benibix.com/term/development/lockfile)
- [Dependency](https://learn.benibix.com/term/development/dependency)
- [Semantic Versioning (SemVer)](https://learn.benibix.com/term/development/semantic-versioning)
- [Dependency Hell](https://learn.benibix.com/term/development/dependency-hell)
- [package.json](https://learn.benibix.com/term/development/package-json)

## Told apart from

- [Lockfile vs Version Pinning](https://learn.benibix.com/compare/lockfile-vs-version-pinning): People think a lockfile and a pinned version are the same thing, and they are not. You pin a version by hand, in the list of packages you asked for. A lockfile is written by the tool. It holds the exact version of every package, even the ones your packages pulled in. So a project can ask for ranges and still get the same install each time.

## Taught in

- [Lockfiles and Version Pinning](https://learn.benibix.com/learn/development-tools/lockfiles-and-version-pinning): Coding Tools, 10/13

![An app box at the top needs two packages, A and B. A asks for package C at version 1, and B asks for C at version 2. Both arrows meet at one box for C, marked as a clash, since only one version fits. At the bottom, a pinned line reads react 18.3.1, beside a range line that reads ^18.3.1 and allows any later 18.x version.](https://learn.benibix.com/diagrams/dev5-version-conflict.svg)

---

Source: https://learn.benibix.com/term/development/version-pinning
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
