Back to results for “ArrayBuffer”
JavaScript › Numbers, Math & BigInt

What is Number.MAX_SAFE_INTEGER and what breaks beyond it?

Intermediate

Answer

It's 2^53 - 1 (9007199254740991), the largest integer JavaScript's double-precision Number type can represent without losing precision. Beyond it, integers can silently round to a nearby representable value, causing incorrect arithmetic and equality checks.
console.log(Number.MAX_SAFE_INTEGER);           // 9007199254740991
console.log(9007199254740992 === 9007199254740993); // true! precision lost
Real-world example A bug where large database IDs (like 64-bit Snowflake IDs) get silently corrupted when passed through JavaScript as regular numbers.

Common follow-ups: How does BigInt solve this precision problem?