JavaScript Number isFinite() Method

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

What You’ll Learn

Number.isFinite() is a static method on Number (same API as MDN Number.isFinite). Call Number.isFinite(value) — not on a number instance. It returns true only for finite number values. This tutorial covers syntax, the difference from global isFinite(), five examples, and try-it labs.

01

Call on

Number only

02

Returns

boolean

03

True when

Finite number

04

False for

Inf / NaN / other

05

Coercion

None

06

Baseline

Everywhere

Introduction

Division by zero, bad math, or missing data can produce Infinity or NaN. Before you format a value or send it to the UI, you often want to know: “Is this a real, finite number?”

Number.isFinite() answers that safely. Unlike the older global isFinite(), it does not convert strings or other types first — so Number.isFinite("25") is false.

💡
Static Method

Static methods belong to Number itself. Always write Number.isFinite(x). There is no (5).isFinite() on Number.prototype.

This page is part of JavaScript Number Methods. Related checks include Number.isInteger() and Number.isNaN().

Understanding the isFinite() Method

Pass any value to Number.isFinite(value). You get true only when both of these are true:

  • The type is "number" (not a string, object, or null).
  • The number is finite — not Infinity, -Infinity, or NaN.

Everything else — including number-looking strings — returns false.

📝 Syntax

General form of the static method Number.isFinite:

JavaScript
Number.isFinite(value)

Parameters

  • value (any) — the value to test for finiteness.

Return value

A boolean:

ValueReturns
Finite number (e.g. 25, 0, -1.5)true
Infinity / -Infinityfalse
NaNfalse
Non-number (e.g. "25", null)false

Exceptions

  • None for normal calls — invalid types simply return false.

Common patterns

JavaScript
Number.isFinite(10 / 5);     // true
Number.isFinite(1 / 0);      // false
Number.isFinite(0 / 0);      // false
Number.isFinite("25");       // false
Number.isFinite(2e64);       // true
isFinite("25");              // true (global — coerces!)

⚡ Quick Reference

GoalCode
Safe finite checkNumber.isFinite(x)
Reject InfinityNumber.isFinite(1 / 0)false
Reject NaNNumber.isFinite(0 / 0)false
Reject stringsNumber.isFinite("0")false
Parse then checkNumber.isFinite(Number(s))
Avoid coercion surprisesPrefer Number.isFinite over global isFinite

🔍 At a Glance

Four facts to remember about Number.isFinite().

Kind
static

Call on Number, not instances

Returns
boolean

true only for finite numbers

Coercion
none

Unlike global isFinite()

Support
Baseline

ES2015+ everywhere modern

📋 Number.isFinite() vs global isFinite()

Number.isFinite(x)isFinite(x)
Coerces first?NoYes (ToNumber)
"25"falsetrue
nullfalsetrue (becomes 0)
Infinityfalsefalse
Best forStrict type-safe checksLegacy / coerced input

Examples Gallery

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

📚 Getting Started

Finite numbers vs Infinity and NaN.

Example 1 — Finite Number

A normal division result is finite.

JavaScript
Number.isFinite(10 / 5);  // true
Try It Yourself

How It Works

10 / 5 is the number 2. It is a number type and finite, so the result is true.

Example 2 — Infinity

Dividing by zero yields Infinity — not finite.

JavaScript
Number.isFinite(1 / 0);  // false
Try It Yourself

How It Works

1 / 0 is Infinity. Number.isFinite(Infinity) and Number.isFinite(-Infinity) are both false.

📈 Practical Patterns

NaN, non-numbers, and large finite values.

Example 3 — NaN

0 / 0 is NaN, which is not finite.

JavaScript
Number.isFinite(0 / 0);  // false
Try It Yourself

How It Works

NaN has type "number", but it is not a finite value, so the check fails.

Example 4 — No String Coercion

Unlike global isFinite, numeric-looking strings are rejected.

JavaScript
Number.isFinite("25");  // false
// isFinite("25");      // true (global coerces)
Try It Yourself

How It Works

The argument is a string, so Number.isFinite returns false immediately. Parse first if you want to accept text input: Number.isFinite(Number("25")).

Example 5 — Large but Finite

Huge magnitudes can still be finite numbers.

JavaScript
Number.isFinite(2e64);  // true
Try It Yourself

How It Works

2e64 is a normal finite Number value. Finiteness is not the same as “small” or “safe integer.”

🚀 Common Use Cases

  • Guard UI formatters — only call toFixed / toPrecision on finite values.
  • Validate math results — catch divide-by-zero before storing data.
  • API payloads — reject Infinity / NaN that JSON cannot represent well.
  • Form input — after Number(raw), confirm the result is finite.
  • Safer than global isFinite — avoid accidental string/null coercion.
  • Charts & gauges — skip plotting non-finite sensor readings.

🧠 How Number.isFinite() Decides

1

Receive value

Any JavaScript value can be passed in.

Input
2

Check type

Must be typeof number — no coercion.

Type
3

Reject Inf / NaN

Infinity, -Infinity, and NaN fail.

Filter
4

Return boolean

true only for finite numbers.

📝 Notes

  • This is a static method — use Number.isFinite(x) only.
  • Does not coerce strings, booleans, null, or objects.
  • Number objects (wrappers) are objects, so Number.isFinite(new Number(1)) is false.
  • Global isFinite is older and coercing — prefer the Number static method in new code.
  • Finite is not the same as integer — Number.isFinite(1.5) is true.
  • For integer checks, use Number.isInteger().

Browser & Runtime Support

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

Baseline · Widely available

Number.isFinite()

Safe for production everywhere. Prefer it over global isFinite() for type-safe checks.

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.isFinite() Excellent

Bottom line: Use Number.isFinite for new code. Parse strings yourself before checking if text input must be accepted.

Conclusion

Number.isFinite() is the modern, static way to ask whether a value is a real finite number — without the coercion surprises of global isFinite().

Continue with Number.isInteger() for whole-number checks, or return to the Number methods hub.

💡 Best Practices

✅ Do

  • Call Number.isFinite(x) on the constructor
  • Parse user text with Number(s) before checking
  • Guard formatters with a finite check
  • Prefer it over global isFinite in new code
  • Treat false as “do not use this value in math/UI”

❌ Don’t

  • Write (5).isFinite() — that is not a Number method
  • Assume strings like "0" pass the check
  • Confuse finite with integer or safe-integer
  • Forget that new Number(1) is an object (returns false)
  • Rely on global isFinite(null) being true

Key Takeaways

Knowledge Unlocked

Five things to remember about Number.isFinite()

Static, strict, boolean check for finite numbers.

5
Core concepts
02

Returns

boolean

Result
03

Rejects

Inf / NaN

Filter
Aa 04

Coercion

none

Strict
05

Safe

Baseline

Support

❓ Frequently Asked Questions

Number.isFinite(value) returns true only when value is of type number and is finite — not Infinity, -Infinity, or NaN. Example: Number.isFinite(10 / 5) is true; Number.isFinite(1 / 0) is false.
Yes. Call it on Number itself: Number.isFinite(x). Do not call it on a number instance like (5).isFinite() — that is not the Number API.
Global isFinite() coerces the argument to a number first, so isFinite("25") is true. Number.isFinite() never coerces — Number.isFinite("25") is false because the value is a string.
No. NaN is not a finite number, so Number.isFinite(NaN) is false. The same applies to Infinity and -Infinity.
Both return false with Number.isFinite. Global isFinite(null) returns true because null coerces to 0 — another reason to prefer the Number static method.
It is Baseline Widely available (ES2015) and supported in every modern browser and Node.js.
Did you know?

JSON cannot represent Infinity or NaN as numbers — JSON.stringify({ x: Infinity }) becomes {"x":null}. Checking with Number.isFinite before stringify helps you catch bad values early.

More Number Methods

Return to the hub for instance and static Number tutorials.

Number methods 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