JavaScript Number.EPSILON Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

Number.EPSILON is the difference between 1 and the next Number greater than 1 — about 2.22e-16 (2-52). Use it as a tolerance when comparing floats near magnitude 1. It is a static property (ES2015), not a method.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use Number.EPSILON. Start with this line.

JavaScript
Number.EPSILON
CallWhat it does
Number.EPSILONPrimary signature.

Built into JavaScript. Read Number.EPSILON on the Number constructor — no import required.

Library declarations
JavaScript
Number.EPSILON

Parameters

ParameterDescription
Scale factorOptional. Needed when |x| is much larger than 1

Return Value

Return ValueDescription
*The current value of Number.EPSILON.

JavaScript Examples

Example 1 — Read Number.EPSILON

Print the constant and confirm it equals 2 ** -52.

JavaScript
console.log(Number.EPSILON);
console.log(Number.EPSILON === 2 ** -52);
Try It Yourself

How It Works

  1. Static access. Read Number.EPSILON on the constructor — there is no (1).EPSILON.
  2. Tiny gap. The printed value is about 2.22e-16.
  3. Exact definition. In IEEE-754 doubles, that spacing is exactly 2 ** -52.
  4. Read-only. Engines expose it as a non-writable constant.

Example 2 — Float Equality Near 1

Use Number.EPSILON so 0.1 + 0.2 compares equal to 0.3.

JavaScript
function equal(x, y) {
  return Math.abs(x - y) < Number.EPSILON;
}

console.log(0.1 + 0.2 === 0.3);       // false
console.log(equal(0.1 + 0.2, 0.3));   // true
Try It Yourself

How It Works

  1. Strict fails. === compares exact bits — float rounding makes them differ.
  2. Absolute error. Math.abs(x - y) measures how far apart the values are.
  3. Tolerance. If that error is smaller than Number.EPSILON, treat them as equal.
  4. Scope. This helper fits values near magnitude 1 (like this classic demo).

Example 3 — Scale Tolerance for Larger Numbers

Bare EPSILON fails around thousands — multiply by the magnitude.

JavaScript
function equal(x, y, tolerance) {
  return Math.abs(x - y) < tolerance;
}

const x = 1000.1;
const y = 1000.2;
const z = 2000.3;

console.log(equal(x + y, z, Number.EPSILON));            // false
console.log(equal(x + y, z, 2000 * Number.EPSILON));     // true
Try It Yourself

How It Works

  1. Bigger spacing. Representable gaps grow with magnitude — bare EPSILON is too tight near 2000.
  2. Bare check fails. x + y is close to z, but not within Number.EPSILON.
  3. Scale it. 2000 * Number.EPSILON widens the allowed error.
  4. Rule of thumb. Use Math.abs(x) * Number.EPSILON (or a domain tolerance) for large values.

Browser & Runtime Support

Number.EPSILON is part of ES2015 and is Baseline Widely available in modern browsers and Node.js.

✓ Baseline · ES2015

Number.EPSILON

Supported in Chrome, Firefox, Safari, Edge, and Node.js for years. Safe for modern apps without a polyfill.

98% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Number.EPSILON Excellent

Bottom line: Use Number.EPSILON freely in modern JavaScript. Older engines without it can use the literal Math.pow(2, -52) as a fallback.

Frequently Asked Questions

Number.EPSILON is the difference between 1 and the next Number greater than 1. Its value is 2^-52, about 2.220446049250313e-16. Read it as Number.EPSILON — a static property, not a method.
Yes. Read it on Number itself: Number.EPSILON. There is no (1).EPSILON on number instances.
Binary floating-point cannot represent 0.1 exactly. 0.1 + 0.2 produces 0.30000000000000004, so strict === 0.3 is false. A tolerance check with Number.EPSILON can treat them as equal when values are near magnitude 1.
No. Bare EPSILON fits arithmetic near magnitude 1. For larger numbers, scale the tolerance (for example Math.abs(x) * Number.EPSILON) or pick a tolerance that matches your data precision.
Number.MIN_VALUE is the smallest positive Number (about 5e-324). Number.EPSILON is the spacing between 1 and the next representable Number (about 2.22e-16). EPSILON is much larger than MIN_VALUE.
It is Baseline Widely available (ES2015) and supported in every modern browser and Node.js.

Next: MAX_VALUE

Learn the largest finite Number JavaScript can represent before overflow to Infinity.

MAX_VALUE tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful