Skip to content
Tutorials Center
My learning

Topics

JavaScript Reference ยท Number and BigInt

Number.MAX_VALUE and Number.MIN_VALUE

Reference for Number.MAX_VALUE and Number.MIN_VALUE: the largest finite and smallest positive doubles, overflow to Infinity, underflow to 0 and common mistakes.

Number.MAX_VALUE is the largest finite number JavaScript can represent, about 1.7976931348623157e+308. Number.MIN_VALUE is the smallest positive number greater than zero, 5e-324.

A calculation that grows past MAX_VALUE becomes Infinity; one that shrinks below MIN_VALUE becomes 0. Neither constant is about integers: for exact whole numbers see Number.MAX_SAFE_INTEGER.

JavaScript
Number.MAX_VALUE
Number.MIN_VALUE

Try it

JS Overflow and underflow

Press Run (or Ctrl + Enter) to see the console output here.

No output.

JS Common mistake: MIN_VALUE is not the lowest number

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Syntax

JavaScript
Number.MAX_VALUE   // 1.7976931348623157e+308
Number.MIN_VALUE   // 5e-324
Part Description
MAX_VALUE The largest positive finite double, (2 - 2 ** -52) * 2 ** 1023.
MIN_VALUE The smallest positive double (a subnormal), 2 ** -1074.
Attributes Not writable, not enumerable, not configurable.

Usage notes

  • MIN_VALUE is positive. It is the closest positive number to zero, not the most negative number. The most negative finite value is -Number.MAX_VALUE.
  • Initial values for searches: use Infinity and -Infinity (or the first element) rather than MAX_VALUE/MIN_VALUE when looking for a minimum or maximum.
  • Overflow gives Infinity, not an error. Test results with Number.isFinite().
  • Underflow gives 0, possibly -0. The sign is kept: -Number.MIN_VALUE / 2 is -0.
  • Precision shrinks with size. Near MAX_VALUE neighbouring doubles are about 2e292 apart, so adding small numbers changes nothing.
  • Integers beyond MAX_SAFE_INTEGER are inexact long before MAX_VALUE. Use BigInt for huge exact integers.
  • Parsing: Number("1e309") is Infinity, and Number("1e-400") is 0.

Browser support

Supported in every browser and JavaScript engine.