Back to results for “Numbers”
JavaScript › Numbers, Math & BigInt

What is BigInt and how do you create one?

Intermediate

Answer

BigInt is a separate numeric type that can represent arbitrarily large integers exactly, with no upper precision limit like regular Numbers. Create one by appending 'n' to an integer literal or calling BigInt(value).
const big = 9007199254740993n;
const big2 = BigInt('9007199254740993');
console.log(big === big2); // true
Real-world example Precisely representing 64-bit database IDs, cryptographic values, or very large financial totals.

Common follow-ups: Can you mix BigInt and Number directly in arithmetic expressions?