isFinite() tells you whether a value is a normal, usable number. It returns true for numbers like 42 or 3.14, and false for NaN, Infinity and -Infinity.
Like isNaN(), it first converts the value to a number. That makes it handy for checking the result of a calculation before you show it, for example after a division.
Remember
isFinite(value);
value -> anything; it is converted with Number(value) first
returns -> true for a normal number
false for NaN, Infinity and -Infinity
Number.isFinite() does the same without the conversion.
Syntax
Call isFinite() by name and give it any value.
JavaScript
isFinite(value);
Call
What it does
isFinite(42)
A normal number. Result: true.
isFinite("3.14")
The text becomes 3.14. Result: true.
isFinite(10 / 0)
Dividing by zero gives Infinity. Result: false.
isFinite("hello")
The text becomes NaN. Result: false.
Built into JavaScript (ES1). It is a global function, so you call it by name with no import. Number.isFinite() is a different, stricter function (ES2015). See also: isNaN(), parseFloat() and parseInt().
Library declarations
JavaScript
// Global function (ES1)
isFinite(value)
// returns true or false
// isFinite(x) is the same as Number.isFinite(Number(x))
Parameters
Parameter
Description
value
The value to test. It can be a number, text, undefined, null, a boolean, an object or an array. It is converted to a number with Number(value) before the test. A BigInt or a Symbol throws a TypeError during that conversion.
Return Value
Return Value
Description
true
The value is, or converts to, a normal number: not NaN and not infinite.
false
The value is, or converts to, NaN, Infinity or -Infinity.
JavaScript Examples
Example 1 — Check Different Values
Pass numbers, text, NaN and infinite results to isFinite().
Global isFinite() converts. The text "25", empty text, null and true become 25, 0, 0 and 1, so it returns true.
Number.isFinite() does not convert. It returns true only when the value is already a number, so only 25 passes.
Text that is not a number."abc" fails in both functions.
Which to use? Use Number.isFinite() to validate data you expect to be a number. Use isFinite() only when you want the conversion.
Compatibility
Browser & Runtime Support
isFinite() is one of the oldest functions in JavaScript. Every browser and every Node.js version has it. Number.isFinite() arrived later, with ES2015.
✓ ES1 · Works everywhere
isFinite()
Supported in all browsers, including old ones, and in Node.js, Deno and Bun.
ES1Standard since
Google ChromeAll versions · Desktop & Mobile
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
OperaAll versions
Full support
Samsung InternetAll versions · Android
Full support
Android WebViewAll versions
Full support
Node.jsAll versions · Server runtime
Supported
DenoAll versions · JavaScript runtime
Supported
BunAll versions · JavaScript runtime
Supported
Internet ExplorerAll versions
Full support
isFinite()Excellent
Bottom line: Safe to use anywhere. The stricter Number.isFinite() is missing only in Internet Explorer.
Frequently Asked Questions
It converts the value to a number and returns true if the result is a normal number. It returns false for NaN, Infinity and -Infinity. For example isFinite(10 / 0) is false and isFinite(10 / 3) is true.
isFinite() converts the value to a number first, so isFinite("25") is true. Number.isFinite() does no conversion and returns true only for real numbers, so Number.isFinite("25") is false. Use Number.isFinite() for strict checks.
isNaN() is true only for NaN. isFinite() is false for NaN and also for Infinity and -Infinity. Use isFinite() when you want to reject every value that is not an ordinary number.
No. 10 / 0 gives Infinity and 0 / 0 gives NaN. Test the result with isFinite() if you want to show a message instead.
Yes, up to Number.MAX_VALUE (about 1.79e308). Calculations that go past that value become Infinity, and isFinite() then returns false.