Number.parseFloat(string) reads a string (or value coerced to string) and returns a floating-point number. It keeps decimals, skips leading whitespace, and stops at the first character that is not part of a valid float. Same function as global parseFloat.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call Number.parseFloat. Start with this line.
JavaScript
Number.parseFloat(string)
Call
What it does
Number.parseFloat(string)
Primary signature.
Number.parseFloat(...)
Call with the arguments your case needs.
Built into JavaScript. Call Number.parseFloat(...) on the Number constructor — no import required.
Library declarations
JavaScript
Number.parseFloat(string)
Parameters
Parameter
Description
string
Required. Value to parse (coerced to string)
Return Value
Return Value
Description
*
Float number, or NaN
JavaScript Examples
Example 1 — Decimals and Scientific Notation
Clean numeric strings parse to floating-point values.
Infinity text."Infinity" parses to the number Infinity — pair with Number.isFinite if you need a finite value.
Compatibility
Browser & Runtime Support
Number.parseFloat() is part of ES2015 (as a Number static) and is Baseline Widely available. Global parseFloat has existed much longer.
✓ Baseline · ES2015
Number.parseFloat()
Supported in Chrome, Firefox, Safari, Edge, and Node.js. Safe for modern apps; global parseFloat works even in very old environments.
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.parseFloatExcellent
Bottom line: Use Number.parseFloat for new code. The global alias is identical and equally safe.
Frequently Asked Questions
Number.parseFloat(string) reads a string and returns a floating-point number. Example: Number.parseFloat("3.14") is 3.14; Number.parseFloat("3.14px") is also 3.14.
Yes. Call it on Number itself: Number.parseFloat(s). It is the same function as the global parseFloat — Number.parseFloat === parseFloat is true.
parseFloat keeps the fractional part: Number.parseFloat("15.9") is 15.9. parseInt stops at the decimal point: Number.parseInt("15.9") is 15. parseFloat has no radix parameter.
Parsing stops at the first character that is not part of a valid float. Number.parseFloat("3.14px") returns 3.14. If nothing valid is found at the start, the result is NaN.
Number("3.14px") is NaN because the whole string must be a valid number. Number.parseFloat("3.14px") is 3.14 because it reads a leading float prefix.
It is Baseline Widely available (ES2015) and supported in every modern browser and Node.js.