= Number.MIN_SAFE_INTEGER; // -(2**53 - 1) => -9007199254740991
    

When parsing data that has been serialized to JSON, integer values falling
outside of this range can be expected to become corrupted when JSON parser
coerces them to ` Number ` type.

A possible workaround is to use [ ` String ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/String) instead.

Larger numbers can be represented using the [ ` BigInt ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

###  Using Number() to convert a Date object

The following example converts the [ ` Date ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Date) object to a numerical
value using ` Number ` as a function:

js

    
    
    const d = new Date("1995-12-17T03:24:00");
    console.log(Number(d));
    

This logs ` 819199440000 ` .

###  Convert numeric strings and null to numbers

js

    
    
    Number("123"); // 123
    Number("123") === 123; // true
    Number("12.3"); // 12.3
    Number("12.00"); // 12
    Number("123e-1"); // 12.3
    Number(""); // 0
    Number(null); // 0
    Number("0x11"); // 17
    Number("0b11"); // 3
    Number("0o11"); // 9
    Number("foo"); // NaN
    Number("100a"); // NaN
    Number("-Infinity"); // -Infinity
    

##  Specifications

Specification  
---  
[ ECMAScript Language Specification  
#  sec-number-objects  ](https://tc39.es/ecma262/multipage/numbers-and-
dates.html#sec-number-objects)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ Polyfill of modern ` Number ` behavior (with support binary and octal literals) in ` core-js ` ](https://github.com/zloirock/core-js#ecmascript-number)
  * [ ` NaN ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)
  * [ Arithmetic operators ](/en-US/docs/Web/JavaScript/Reference/Operators#arithmetic_operators)
  * [ ` Math ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)
  * [ ` BigInt ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modified on  Oct 18, 2023  by  [ MDN contributors ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Number/contributors.txt) .

[ View this page on GitHub
](https://github.com/mdn/content/blob/main/files/en-
us/web/javascript/reference/global_objects/number/index.md?plain=1 "Folder:
en-us/web/javascript/reference/global_objects/number \(Opens in a new tab\)")
â¢  [ Report a problem with this content
](https://github.com/mdn/content/issues/new?template=page-report.yml&mdn-
url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FNumber&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-
us%2Fweb%2Fjavascript%2Freference%2Fglobal_objects%2Fnumber%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FNumber%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-
us%2Fweb%2Fjavascript%2Freference%2Fglobal_objects%2Fnumber%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F295116d4250781c6cab89ac3cc5df11e2632391f%0A*+Document+last+modified%3A+2023-10-18T16%3A59%3A30.000Z%0A%0A%3C%2Fdetails%3E
"This will take you to GitHub to file a new issue.")

[ MDN logo  ](/)

Your blueprint for a better internet.

  * [ MDN on Mastodon  ](https://mozilla.social/@mdn)
  * [ MDN on X (formerly Twitter)  ](https://twitter.com/mozdevnet)
  * [ MDN on GitHub  ](https://github.com/mdn/)
  * [ MDN Blog RSS Feed  ](/en-US/blog/rss.xml)

##  MDN

  * [ About ](/en-US/about)
  * [ Blog ](/en-US/blog/)
  * [ Careers ]