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
Call
What it does
Number.EPSILON
Primary signature.
Built into JavaScript. Read Number.EPSILON on the Number constructor — no import required.
Library declarations
JavaScript
Number.EPSILON
Parameters
Parameter
Description
Scale factor
Optional. Needed when |x| is much larger than 1
Return Value
Return Value
Description
*
The current value of Number.EPSILON.
JavaScript Examples
Example 1 — Read Number.EPSILON
Print the constant and confirm it equals 2 ** -52.
Bigger spacing. Representable gaps grow with magnitude — bare EPSILON is too tight near 2000.
Bare check fails.x + y is close to z, but not within Number.EPSILON.
Scale it.2000 * Number.EPSILON widens the allowed error.
Rule of thumb. Use Math.abs(x) * Number.EPSILON (or a domain tolerance) for large values.
Compatibility
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 ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Number.EPSILONExcellent
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.