Number.MAX_SAFE_INTEGER

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨September 2015⁩.

The Number.MAX_SAFE_INTEGER static data property represents the maximum safe integer in JavaScript (253 – 1).

For larger integers, consider using BigInt.

Try it

const x = Number.MAX_SAFE_INTEGER + 1;
const y = Number.MAX_SAFE_INTEGER + 2;

console.log(Number.MAX_SAFE_INTEGER);
/ Expected output: 9007199254740991

console.log(x);
/ Expected output: 9007199254740992

console.log(x === y);
/ Expected output: true

Value

9007199254740991 (9,007,199,254,740,991, or ~9 quadrillion).

Property attributes of Number.MAX_SAFE_INTEGER
Writableno
Enumerableno
Configurableno

Description

Double precision floating point format only has 52 bits to represent the Number.isSafeInteger() for more information.

As mentioned in Number.MAX_VALUE, which is approximately 1.7976931348623157 × 10308.

Because MAX_SAFE_INTEGER is a static property of Number, you always use it as Number.MAX_SAFE_INTEGER, rather than as a property of a number value.

Examples

Return value of MAX_SAFE_INTEGER

js
Number.MAX_SAFE_INTEGER; / 9007199254740991

Relationship between MAX_SAFE_INTEGER and EPSILON

Number.EPSILON is 2-52, while MAX_SAFE_INTEGER is 253 – 1 — both of them are derived from the width of the mantissa, which is 53 bits (with the highest bit always being 1). Multiplying them will give a value very close — but not equal — to 2.

js
Number.MAX_SAFE_INTEGER * Number.EPSILON; / 1.9999999999999998

Specifications

Specification
ECMAScript® 2026 Language Specification
# sec-number.max_safe_integer

Browser compatibility

See also

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant