Guide

Semver Ranges

Learn how to use semver ranges to filter package versions on npmx.dev

npm uses semantic versioning (semver) to manage package versions. A semver range is a string that describes a set of version numbers. On npmx, you can type a semver range into the version filter input on any package page to quickly find matching versions.

Version format

Every npm version follows the format MAJOR.MINOR.PATCH, for example 3.2.1:

  • MAJOR - incremented for breaking changes
  • MINOR - incremented for new features (backwards-compatible)
  • PATCH - incremented for bug fixes (backwards-compatible)

Some versions also include a prerelease tag, such as 4.0.0-beta.1.

Common range syntax

RangeMeaningExample matches
*Any version0.0.2, 3.1.0, 3.2.6
^3.0.0Compatible with 3.x (same major)3.0.0, 3.1.0, 3.9.5
~3.2.0At least 3.2.0, same major.minor3.2.0, 3.2.1, 3.2.99
3.2.xAt least 3.2.0, same major.minor3.2.0, 3.2.1, 3.2.99
>=2.0.0 <3.0.0At least 2.0.0 but below 3.0.02.0.0, 2.5.3, 2.99.0
1.2.3Exactly this version1.2.3
=1.2.3Exactly this version1.2.3
^0.3.1At least 0.3.1, same major.minor (0.x is special)0.3.1, 0.3.2
^0.0.4Exactly 0.0.4 (0.0.x is special)0.0.4 (only)

Examples

Find all 3.x versions

Type ^3.0.0 to see every version compatible with major version 3.

Find patch releases for a specific minor

Type ~2.4.0 to see only 2.4.x patch releases (2.4.0, 2.4.1, 2.4.2, etc.).

Find versions in a specific range

Type >=1.0.0 <2.0.0 to see all 1.x stable releases.

Find a specific version

Type the exact version number, like 5.3.1, to check if it exists.

Find prerelease versions

Type >=3.0.0-alpha.0 to find alpha, beta, and release candidate versions for a major release.

Learn more

The full semver range specification is documented at node-semver.