SemVer Range Calculator
Test semantic version ranges against a list of versions. Enter a range like ^1.2.3 or >=1.0.0 <2.0.0 and instantly see which versions match. Supports all npm range operators.
Frequently Asked Questions
What is the difference between ^ (caret) and ~ (tilde) in semver ranges?▼
Caret (^) allows changes that do not modify the leftmost non-zero element of the version. For ^1.2.3 it means >=1.2.3 <2.0.0 — minor and patch updates are allowed, but the major version is locked. For ^0.2.3 it means >=0.2.3 <0.3.0 — when major is 0, the minor version is treated as the major and only patches are allowed. For ^0.0.3 it means exactly =0.0.3. Tilde (~) is more conservative: ~1.2.3 means >=1.2.3 <1.3.0 — only patch updates are allowed within the same minor version. Use ~ when you want the most conservative updates; use ^ for typical library dependencies where you trust the author to maintain backward compatibility within a major version.
How do pre-release versions (alpha, beta, rc) work with semver ranges?▼
Pre-release versions (e.g. 2.0.0-alpha.1, 1.0.0-beta.2, 3.0.0-rc.1) are treated as lower than the release version they precede. So 2.0.0-alpha.1 < 2.0.0. By default, ranges like ^1.2.3 and >=1.0.0 do NOT match pre-release versions of a different major.minor.patch unless the range itself includes a pre-release tag. For example, >=1.0.0-alpha will match 1.0.0-alpha.1, but >=1.0.0 will NOT match 1.0.0-alpha.1. This protects users from accidentally getting unstable pre-release versions when updating.
What does npm update actually install based on my range in package.json?▼
npm install (fresh) resolves the range to the highest matching version at install time and writes the exact version to package-lock.json. Subsequent npm install commands use the lockfile and install that exact version — your range is only consulted when there is no lockfile. npm update (or npm update package-name) re-resolves the range and installs the highest matching version, updating the lockfile. npm outdated shows you the current, wanted (highest matching your range), and latest (absolute latest) versions. The range in package.json defines the update boundary; the lockfile pins the exact resolved version.
What is the SemVer specification and who maintains it?▼
Semantic Versioning (SemVer) is a versioning scheme specified at semver.org. A version has the format MAJOR.MINOR.PATCH where MAJOR increments indicate breaking changes, MINOR increments indicate backward-compatible new features, and PATCH increments indicate backward-compatible bug fixes. Pre-release versions are denoted with a hyphen (1.0.0-alpha.1) and build metadata with a plus sign (1.0.0+build.123). The specification was created by Tom Preston-Werner (GitHub co-founder). npm, Cargo, Composer, and most package managers follow SemVer conventions, though the exact range syntax varies between ecosystems — Cargo and npm have slightly different caret range semantics for 0.x versions.
Why do lock files matter if I already have a version range?▼
Lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock) record the exact resolved version of every dependency (and transitive dependency) at a specific point in time. Without a lock file, the same package.json could install different versions on different machines or at different times — a new patch released between your CI run and a teammate's install could cause different behavior. Lock files give you reproducible builds. The version range in package.json defines the upgrade boundary (what you're willing to accept), while the lock file ensures everyone runs the same exact versions. Commit lock files for applications; for libraries, omit them so consumers get the latest compatible versions.
What does MAJOR.MINOR.PATCH actually mean in practice?▼
MAJOR (e.g. 2.0.0): You made breaking changes — renamed/removed APIs, changed function signatures, dropped support for older Node/Python versions. Dependents MUST update their code to keep working. MINOR (e.g. 1.3.0): You added new functionality in a backward-compatible way — new functions, new optional parameters, new exports. Dependents can upgrade safely without changing their code, though they might want to use the new features. PATCH (e.g. 1.2.4): Bug fixes only — no new features, no API changes. Always safe to upgrade. In practice, many projects bump MAJOR for any significant change even if technically compatible, while others underuse MAJOR and make breaking changes in MINOR — always read the CHANGELOG before upgrading.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
npm Package Stats
Look up npm package weekly download counts, unpacked size, dependency count, latest version, license, and repository link. Live data from the npm registry.
Open free tool →
pnpm Workspace Generator
GUI to configure a pnpm monorepo workspace with package globs, catalog entries, overrides, and options. Generates a ready-to-use pnpm-workspace.yaml file.
Open free tool →
NPM Bundle Size Estimator
Check npm package bundle sizes — minified and gzip. Enter multiple packages at once, see tree-shaking info, and compare sizes side by side.
Open free tool →
More Free Tools
Related Articles
npm vs yarn vs pnpm vs bun: Which Package Manager Should You Use in 2025?
An honest, benchmark-backed comparison of npm, Yarn, pnpm, and Bun in 2025 — covering install speed, disk usage, monorepo support, and when to pick each one for your JavaScript project.
Bun Shell Scripting Guide: Replace Bash Scripts with $.cmd() and Bun APIs
Learn how to replace complex bash scripts with Bun's built-in shell API. Covers $.cmd(), Bun.file(), spawn(), and practical real-world automation scripts.
JSR vs npm: The New JavaScript Package Registry - Complete Migration Guide 2026
JSR is redefining JavaScript package distribution with TypeScript-first design, native Deno/Bun/Node support, and a built-in scoring system. Learn how it compares to npm and how to migrate your packages in 2026.
pnpm vs npm vs yarn: Package Manager Performance Benchmark 2026
Real benchmarks comparing pnpm, npm, and yarn in 2026 — install speed, disk usage, monorepo support, lockfile format, and which to choose for your JavaScript project.
TypeScript 5.5 New Features: Complete Guide for Developers 2026
Everything you need to know about TypeScript 5.5: inferred type predicates, isolated declarations, JSDoc @import tag, new Set methods, and performance improvements. With practical code examples.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →