The internal workings are not that different, as @James Allardic already answered. There is a difference though. Using parseFloat, a (trimmed) string starting with one or more numeric characters followed by alphanumeric characters can convert to a Number, with Number that will not succeed. As in:

parseFloat('3.23abc'); //=> 3.23
Number('3.23abc'); //=> NaN

In both conversions, the input string is trimmed, by the way:

parseFloat('  3.23abc '); //=> 3.23
Number('   3.23 '); //=> 3.23
Answer from KooiInc on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ jsref_parsefloat.asp
W3Schools.com
The parseFloat() method parses a value as a string and returns the first number.
Discussions

What is the difference between Number(...) and parseFloat(...)
The internal workings are not that different, as @James Allardic already answered. There is a difference though. Using parseFloat, a (trimmed) string starting with one or more numeric characters followed by alphanumeric characters can convert to a Number, with Number that will not succeed. More on stackoverflow.com
๐ŸŒ stackoverflow.com
When does parseFloat decide to round?
Welcome to the wonderful world of floating point numbers. More on reddit.com
๐ŸŒ r/javascript
13
1
October 20, 2014
javascript - parseFloat(number2) returning int
This looks like a locale problem: parseFloat only recognizes a period as a decimal point; it stops parsing when it gets to the comma, giving you only integer values. Unfortunately, there is no way to change this behavior. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Newest 'parsefloat' Questions - Stack Overflow
Stack Overflow | The Worldโ€™s Largest Online Community for Developers More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ javascript โ€บ number methods โ€บ .parsefloat()
JavaScript | Number Methods | .parseFloat() | Codecademy
May 31, 2024 - In JavaScript, the .parseFloat() method parses a given string and returns the first floating-point number found in the string. Parsing stops when it encounters a character that is not part of a valid number.
Top answer
1 of 5
67

The internal workings are not that different, as @James Allardic already answered. There is a difference though. Using parseFloat, a (trimmed) string starting with one or more numeric characters followed by alphanumeric characters can convert to a Number, with Number that will not succeed. As in:

parseFloat('3.23abc'); //=> 3.23
Number('3.23abc'); //=> NaN

In both conversions, the input string is trimmed, by the way:

parseFloat('  3.23abc '); //=> 3.23
Number('   3.23 '); //=> 3.23
2 of 5
33

No. Both will result in the internal ToNumber(string) function being called.

From ES5 section 15.7.1 (The Number Constructor Called as a Function):

When Number is called as a function rather than as a constructor, it performs a type conversion...

Returns a Number value (not a Number object) computed by ToNumber(value) if value was supplied, else returns +0.

From ES5 section 15.1.2.3 (parseFloat (string)):

... If neither trimmedString nor any prefix of trimmedString satisfies the syntax of a StrDecimalLiteral (see 9.3.1) ...

And 9.3.1 is the section titled "ToNumber Applied to the String Type", which is what the first quote is referring to when it says ToNumber(value).


Update (see comments)

By calling the Number constructor with the new operator, you will get an instance of the Number object, rather than a numeric literal. For example:

typeof new Number(10); //object
typeof Number(10); //number

This is defined in section 15.7.2 (The Number Constructor):

When Number is called as part of a new expression it is a constructor: it initialises the newly created object.

๐ŸŒ
Oracle
docs.oracle.com โ€บ cd โ€บ B40099_02 โ€บ books โ€บ eScript โ€บ eScript_JSReference199.html
Bookshelf v8.0: parseFloat() Method
Siebel eScript Language Reference > Siebel eScript Commands > Conversion Methods > ยท This method converts an alphanumeric string to a floating-point decimal number
๐ŸŒ
Flexiple
flexiple.com โ€บ javascript โ€บ parsefloat-javascript
parseFloat JavaScript: Syntax and Examples - Flexiple
March 14, 2022 - Learn how to use the JavaScript parseFloat function to convert strings to floating-point numbers accurately. Examples and tips included.
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ javascript-number-parsefloat-method
JavaScript Number parseFloat() Method - GeeksforGeeks
July 11, 2025 - JavaScript parseFloat() Method is used to accept the string and convert it into a floating-point number. If the string does not contain a numeral value or If the first character of the string is not a Number then it returns NaN i.e, not a number.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ Number โ€บ parseFloat
Number.parseFloat() - JavaScript | MDN
The Number.parseFloat() static method parses an argument and returns a floating point number. If a number cannot be parsed from the argument, it returns NaN.
๐ŸŒ
YouTube
youtube.com โ€บ steve griffith
How to Use parseInt and parseFloat - YouTube
This tutorial explains how you can use parseInt and parseFloat to extract numeric values from Strings, as well as, why you would want to do this. Sample Code...
Published ย  January 10, 2020
Views ย  3K
๐ŸŒ
Edgecompute
js-compute-reference-docs.edgecompute.app โ€บ parsefloat()
parseFloat() | @fastly/js-compute
The parseFloat function converts its first argument to a string, parses that string as a decimal number literal, then returns a number or NaN.
๐ŸŒ
Medium
medium.com โ€บ @maxheadway โ€บ the-differences-between-number-and-parsefloat-in-javascript-8ee74b961ed4
The differences between Number() and parseFloat() in Javascript | by Max Headway | Medium
February 19, 2023 - The parseFloat Function The parseFloat function is used to convert a string to a floating-point number. It parses the string argument and returns a floating-point number.
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ javascript โ€บ global โ€บ parseFloat
JavaScript parseFloat() - Parse String to Float | Vultr Docs
November 6, 2024 - The parseFloat() function in JavaScript is a invaluable tool for transforming string data into float numbers, significantly aiding in calculations and data processing. It efficiently handles a variety of string formats including those with ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ float-parsefloat-method-in-java-with-examples
Float parseFloat() method in Java with examples - GeeksforGeeks
July 11, 2025 - The parseFloat() method in Float Class is a built in method in Java that returns a new float initialized to the value represented by the specified String, as done by the valueOf method of class Float.
๐ŸŒ
Copahost
copahost.com โ€บ home โ€บ javascript parsefloat: examples and variations of this function
Javascript parseFloat: Examples and variations of this function - Copahost
July 16, 2023 - We can use the parseFloat method to convert a string into a floating-point number. The parseFloat method takes a string value and returns a floating-point number. But there are few rules for using parseFloat method in JavaScript.
๐ŸŒ
Medium
medium.com โ€บ @roy.elaawar โ€บ parsefloat-vs-parstint-in-javascript-4f3d345f205f
ParseFloat vs ParseInt in JavaScript | by Roy Elaawar | Medium
November 6, 2023 - ParseFloat vs ParseInt in JavaScript Both of these functions are crucial for extracting numeric values from strings, and they each have their own unique characteristics and uses. parseFloat is a โ€ฆ
๐ŸŒ
Reddit
reddit.com โ€บ r/javascript โ€บ when does parsefloat decide to round?
r/javascript on Reddit: When does parseFloat decide to round?
October 20, 2014 -

I'm using parseFloat and am a bit confused about when it decides to round.

parseFloat("34.799999999999997") returns 34.8 parseFloat("34.79") returns 34.79

Why is the first rounded to one decimal place and the second is left alone?

Top answer
1 of 5
5
Welcome to the wonderful world of floating point numbers.
2 of 5
3
It's not that parseFloat() is doing any rounding. That's not how you should look at it. The way you should look at it is that neither 34.799999999999997 nor 34.8 can be represented exactly by binary floating point. The closest representable IEEE double is 34.7999999999999971578290569595992565155029296875. As you can see, that value lies in between 34.799999999999997 and 34.8. That is, if you ask, "What is the nearest representable value to 34.799999999999997?" the answer is "34.7999999999999971578290569595992565155029296875, which is slightly larger." Likewise, if you ask, "What is the nearest representable value to 34.8?" the answer is, "34.7999999999999971578290569595992565155029296875, which is slightly smaller." In other words, as far as IEEE binary floating point numbers are concerned, 34.799999999999997 and 34.8 are equivalent values. They are two different ways of referring to the same number, 34.7999999999999971578290569595992565155029296875. When given a choice between two representations for the same number, the smaller or more compact one is chosen. This is an implementation detail, but it's one that's commonly made. 34.79 also is impossible to represent exactly in IEEE binary floating point. The nearest representable IEEE double is 34.78999999999999914734871708787977695465087890625. So when you write 34.79, you're getting 34.78999999999999914734871708787977695465087890625. As before, when displaying a floating point number, the library routines try to find the smallest representation that still round-trips to the same number. That's why 34.79 is the result of printing 34.78999999999999914734871708787977695465087890625 and not 34.78999999999999914734871708787977695465087890625. As a thought experiment, we can undo this choice, however: parseFloat("34.799999999999997") == 34.7999999999999971578290569595992565155029296875 parseFloat("34.8" == 34.7999999999999971578290569595992565155029296875 parseFloat("34.79") == 34.78999999999999914734871708787977695465087890625 That's what's actually going on. Those are the real values that you're using. It's just that for display purposes, people don't want to deal with 34.7999999999999971578290569595992565155029296875. If two things both result in the same value, they are equivalent, and the smaller one can be used as a representation.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-parse-float-with-two-decimal-places-in-javascript
How to Parse Float with Two Decimal Places in JavaScript? - GeeksforGeeks
The parseFloat() method converts a string to a floating-point number. If the string isn't numeric, it returns NaN.
Published ย  July 23, 2025
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ tagged โ€บ parsefloat
Newest 'parsefloat' Questions - Stack Overflow
In my test, I need to parseFloat() a string. The issue is that hyphen-minus instantly occurs NaN.