Number.MAX_SAFE_INTEGER

The maximum safe integer in JavaScript (2^53 - 1).

Since ES2015 Spec ↗

Syntax

Number.MAX_SAFE_INTEGER

Returns

number — The constant 9007199254740991.

Examples

console.log(Number.MAX_SAFE_INTEGER);
Output
9007199254740991
console.log(Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2);
Output
true

Notes

Beyond this value, integer arithmetic loses precision (note the example where +1 and +2 compare equal). Use BigInt for larger exact integers. It is a static, non-writable property.

Browser & runtime support

EnvironmentSince version
chrome 34
firefox 31
safari 9
edge 12
node 0.12

See also