Favorites

JavaScript Number.EPSILON Property

☕
Enjoying this site?

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

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

Number.EPSILON is the smallest gap between 1 and the next representable number. It's used as a tolerance when comparing decimal results.

Description

The Number.EPSILON static property is the difference between 1 and the smallest floating point number greater than 1. Because decimals like 0.1 can't be stored exactly, it is sometimes used as a tolerance when comparing calculated values: Math.abs(a - b) < Number.EPSILON. For numbers far from 1, a tolerance scaled to their size is more appropriate.

The gap between representable numbers grows as numbers get bigger, so a fixed epsilon only makes sense for values around 1. For larger values, scale the tolerance, as in Math.abs(a - b) < Number.EPSILON * Math.max(Math.abs(a), Math.abs(b)), or choose a tolerance suited to your data, such as 0.001 for measurements.

In many cases, rounding to a fixed number of decimal places before comparing, or working in whole units such as cents, is simpler and less error-prone than comparing floating point numbers with a tolerance. Like other static members of Number, it is called on the Number constructor itself, not on individual number values.

Syntax

Number.EPSILON

Value

The difference between 1 and the smallest number greater than 1 that can be represented, about 2.22 × 10-16.

Example

console.log(Number.EPSILON);
const a = 0.1 + 0.2;
console.log(a === 0.3);
console.log(Math.abs(a - 0.3) < Number.EPSILON);

Browser Support

The following information will show you the current browser support for the Number.EPSILON 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