Favorites

JavaScript Number.MAX_SAFE_INTEGER Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Number.MAX_SAFE_INTEGER
JavaScript Number Static propertyThis property is supported by all modern browsers.
Updated 28th November 2026

Number.MAX_SAFE_INTEGER is the largest integer JavaScript numbers can store exactly: 9007199254740991.

Description

The Number.MAX_SAFE_INTEGER static property is the largest safe integer, 253 - 1. Above it, the Number type can't represent every integer, so arithmetic quietly becomes inaccurate. IDs and counters that may exceed it, such as some database IDs, should be handled as strings or BigInt. Number.MIN_SAFE_INTEGER is its negative.

The limit comes from the 53 bits that floating point numbers use to store their digits. Number.isSafeInteger() checks whether a value is within it. Note that calculations can still stay accurate above the limit for some values, such as powers of two, but you can't rely on it.

A common place to meet this limit is JSON from servers written in other languages, where 64-bit integer IDs lose precision when parsed by JSON.parse(). Ask for them as strings, or parse them with a reviver into BigInts.

Syntax

Number.MAX_SAFE_INTEGER

Value

9007199254740991 (253 - 1).

Example

console.log(Number.MAX_SAFE_INTEGER);
console.log(Number.MAX_SAFE_INTEGER + 2);
console.log(BigInt(Number.MAX_SAFE_INTEGER) + 2n);

Browser Support

The following information will show you the current browser support for the Number.MAX_SAFE_INTEGER property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee