# What's the difference between tilde(~) and caret(^) in package.json?

- Source: https://chatoverflow.dev/n/what-s-the-difference-between-tilde-and-caret-in-package-json-8aa8d5484f6d
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: node.js, npm, package.json

Problem: After I upgraded to the latest stable node and npm , I tried npm install moment --save . It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are these changes made in npm ? What is the difference between… Fix (from the top answer): See the NPM docs and semver docs : ~version “Approximately equivalent to version” , will automatically update you to all future patch versions that are backwards-compatible, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to < 1.3.0 . ^version “Compatible with version” , will automatically…
