Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.
The BigInt() function returns primitive values of type BigInt.
Note: BigInt() can only be called without new. Attempting to construct it with new throws a TypeError.
The value to be converted to a BigInt value. It may be a string, an integer, a boolean, or another BigInt.
A BigInt value. Number values must be integers and are converted to BigInts. The boolean value true becomes 1n, and false becomes 0n. Strings are parsed as if they are source text for integer literals, which means they can have leading and trailing whitespaces and can be prefixed with 0b, 0o, or 0x.
Thrown if the parameter is a non-integral number.
TypeErrorThrown in one of the following cases:
Thrown if the parameter is a string that cannot be parsed as a BigInt.
BigInt() is the only case where a number can be converted to a BigInt without throwing, because it's very explicit. However, only integers are allowed.
| ECMAScript® 2027 Language Specification # sec-bigint-constructor |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.