Course contentsShow
← JavaScript
Lesson 1969 of 2,72341. Modern JavaScript Features (ES2020+)Free lesson

BigInt Arithmetic Operations

Perform addition, subtraction, multiplication, and division with BigInt values.

BigInt Arithmetic Operations

You'll learn how to perform basic math operations with BigInt values in JavaScript.

Understanding BigInt Math

Now that you can create BigInt values, it's time to actually compute with them. BigInt supports the same arithmetic operators you already know—addition, subtraction, multiplication, and division—but with one key rule: you cannot mix BigInt and regular Number types in the same operation.

Think of BigInt and Number as speaking different languages. They need to stay in their own lanes.

The Core Operations

Here's how each arithmetic operator works with BigInt:

const a = 10n;
const b = 3n;

// Addition
const sum = a + b;  // 13n

// Subtraction
const diff = a - b;  // 7n

// Multiplication
const product = a * b;  // 30n

// Division (returns integer result, discards remainder)
const quotient = a / b;  // 3n

// Modulus (remainder)
const remainder = a % b;  // 1n

// Exponentiation
const power = a ** b;  // 1000n

Important Quirks

Division truncates: Unlike regular division, BigInt division always returns just the whole number part, throwing away any remainder. 10n / 3n gives 3n, not 3.33....

No mixing types: This will throw an error:

const wrong = 10n + 5;  // TypeError!

You must convert one or the other first using BigInt() or Number().

**Key Takeaway: BigInt supports all standard arithmetic operations (+, -, *, /, %, ) but only between BigInt values, and division always returns an integer result.