JavaScript Number EPSILON Property

Beginner
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Static property

What You’ll Learn

Number.EPSILON is a static data property on Number (same API as MDN Number.EPSILON). It is the difference between 1 and the next greater representable Number — about 2.22e-16. This tutorial covers its value, float equality, when not to use a bare EPSILON, five examples, and try-it labs.

01

Kind

Static property

02

Value

2−52

03

Means

Gap after 1

04

Use for

Near-1 equality

05

Writable

No

06

Baseline

Everywhere

Introduction

JavaScript numbers use IEEE-754 double precision. Only finitely many values fit in 64 bits, so many decimals — including 0.1 — are approximations. That is why 0.1 + 0.2 === 0.3 is false.

Number.EPSILON names the spacing between 1 and the next Number. Near magnitude 1, that spacing is a common starting tolerance for “close enough” equality checks.

💡
Static Property

Static properties belong to Number itself. Always write Number.EPSILON. There is no (1).EPSILON, and you do not call it like a function.

This page is part of JavaScript Number Properties. Related tools include Number.isNaN() and Number.isFinite() for validating numeric results.

Understanding the EPSILON Property

Double precision stores a 52-bit fraction (mantissa). At magnitude 1, the least significant bit is worth 2−52 — that is Number.EPSILON.

  • It is a constant number, not a method.
  • It describes accuracy around 1, not absolute accuracy everywhere.
  • As numbers grow, the gap between representable values also grows.
  • It is much larger than Number.MIN_VALUE (the tiniest positive Number).

📝 Syntax

General form of the static property Number.EPSILON:

JavaScript
Number.EPSILON

Value

2−52, approximately 2.220446049250313e-16.

Property attributes

AttributeValue
Writablefalse
Enumerablefalse
Configurablefalse

Common patterns

JavaScript
Number.EPSILON;                         // ≈ 2.220446049250313e-16
Number.EPSILON === 2 ** -52;            // true

Math.abs(0.2 - 0.3 + 0.1) < Number.EPSILON;  // true

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

⚡ Quick Reference

GoalCode
Read machine epsilonNumber.EPSILON
Confirm 2−52Number.EPSILON === 2 ** -52
Near-1 equalityMath.abs(x - y) < Number.EPSILON
Scaled toleranceMath.abs(x - y) < Math.abs(x) * Number.EPSILON
Data-step toleranceMath.abs(x - y) < 0.01 (example)
Strict equality=== (avoid for most floats)

🔍 At a Glance

Four facts to remember about Number.EPSILON.

Kind
static

Property on Number

Value
2**-52

≈ 2.22e-16

Best for
~1

Arithmetic near magnitude 1

Mutable
no

Read-only constant

📋 === vs Number.EPSILON vs scaled tolerance

Case===Bare EPSILONScaled / custom
0.1 + 0.2 vs 0.3falsetrue (near 1)true
1000.1 + 1000.2 vs 2000.3falsefalse (too strict)true with 2000 * EPSILON
Form steps of 0.1Often falseToo strictUse e.g. 0.01

Examples Gallery

Examples follow MDN Number.EPSILON patterns. Use View Output or Try It Yourself for each case.

📚 Getting Started

Read the constant and see MDN’s tiny-error demo.

Example 1 — Read Number.EPSILON

Print the constant and confirm it equals 2−52.

JavaScript
Number.EPSILON;
Number.EPSILON === 2 ** -52;  // true
Try It Yourself

How It Works

The engine exposes the IEEE-754 unit in the last place at 1.0 as a named constant.

Example 2 — MDN Tiny Error

A classic cancellation leaves a residual smaller than EPSILON.

JavaScript
const result = Math.abs(0.2 - 0.3 + 0.1);

result;                       // 2.7755575615628914e-17
result < Number.EPSILON;      // true
Try It Yourself

How It Works

The absolute residual is smaller than the gap at 1, so it counts as “numerically zero” for near-1 work.

📈 Practical Patterns

Equality helpers and magnitude caveats from MDN.

Example 3 — Equality Helper (Near 1)

Treat two values as equal when their difference is below EPSILON.

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

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

How It Works

Strict equality fails because of binary rounding. A small absolute tolerance succeeds when values are near 1.

Example 4 — Bare EPSILON Fails at Larger Magnitude

Around 2000, rounding error can exceed EPSILON.

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

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

x + y;            // 2000.3000000000002
equal(x + y, z);  // false
Try It Yourself

How It Works

Absolute accuracy shrinks as the exponent grows. Do not use a bare EPSILON for all sizes.

Example 5 — Scaled Tolerance

Pass a larger tolerance when the magnitude is large.

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

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

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

How It Works

MDN-style fix: scale EPSILON by the magnitude of the data. Match tolerance to both size and input precision.

🚀 Common Use Cases

  • Near-1 equality — compare results of float math when values are around 1.
  • Geometry / graphics — treat residuals as zero when they fall under a chosen epsilon.
  • Unit tests — assert approximate equality instead of brittle ===.
  • Teaching floating point — explain why decimals misbehave in binary IEEE-754.
  • Scaled checks — multiply EPSILON by magnitude for larger numbers.
  • Not a universal default — form inputs with step 0.1 often need a much larger tolerance.

🧠 How Floating-Point Equality Uses EPSILON

1

Compute difference

Math.abs(x - y) measures how far apart the values are.

Diff
2

Pick a tolerance

Near 1: EPSILON. Larger data: scale it. User data: match step size.

Tol
3

Compare

If the difference is smaller than the tolerance, treat as equal.

Check
4

Return boolean

Approximate equality — not bitwise identity.

📝 Notes

  • This is a static property — use Number.EPSILON only.
  • Do not write Number.EPSILON() — it is not a function.
  • Do not use bare EPSILON for every float comparison.
  • Accuracy decreases as magnitude increases.
  • Number.MIN_VALUE is a different concept (smallest positive Number).
  • Prefer a tolerance that matches your data’s magnitude and precision.

Browser & Runtime Support

Number.EPSILON is Baseline Widely available — part of ES2015 and supported in every modern browser and Node.js.

Baseline · Widely available

Number.EPSILON

Safe for production everywhere. Use it as a named machine epsilon near magnitude 1.

100% Universal 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 for near-1 float equality. Scale or replace the tolerance for larger magnitudes and coarser input precision.

Conclusion

Number.EPSILON is the static constant for the gap after 1 in IEEE-754 doubles — a practical starting point for approximate equality when values sit near magnitude 1.

Continue with more Number properties, validate results with isFinite(), or browse Number methods.

💡 Best Practices

✅ Do

  • Read Number.EPSILON on the constructor
  • Use it for float equality near magnitude 1
  • Scale tolerance with magnitude when numbers are large
  • Match tolerance to input precision (forms, sensors, UI steps)
  • Document why you chose a given epsilon

❌ Don’t

  • Write (1).EPSILON or Number.EPSILON()
  • Assume EPSILON works for every float comparison
  • Use === for most floating-point checks
  • Confuse EPSILON with Number.MIN_VALUE
  • Ignore the magnitude of your data

Key Takeaways

Knowledge Unlocked

Five things to remember about Number.EPSILON

Static machine epsilon for floating-point closeness near 1.

5
Core concepts
📝 02

Value

2**-52

Constant
1 03

Scope

near 1

Use
04

Equality

tolerance

Pattern
05

Scale

when large

Caveat

❓ Frequently Asked Questions

Number.EPSILON is the difference between 1 and the smallest Number greater than 1. Its value is 2^-52, about 2.220446049250313e-16. Use 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. EPSILON fits arithmetic near magnitude 1. For larger numbers, scale the tolerance (for example magnitude * Number.EPSILON) or use 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.
Did you know?

Machine epsilon is a classic numerical-analysis idea. In JavaScript it is exposed as Number.EPSILON, equal to 2 ** -52 — the unit in the last place at 1.0 for IEEE-754 binary64 numbers.

More Number Properties

Return to the hub for static Number constants.

Number properties hub →

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.

8 people found this page helpful