Favorites

JavaScript ** Exponentiation Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
**
JavaScript Arithmetic OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The exponentiation operator (**) raises the first number to the power of the second. It is the same as Math.pow() but shorter.

Description

The exponentiation operator ** returns the left operand raised to the power of the right. It's equivalent to Math.pow() and also works with BigInt. It is right-associative: 2 ** 3 ** 2 means 2 ** (3 ** 2), which is 512.

A unary operator can't come directly before the base, so -2 ** 2 is a syntax error; write (-2) ** 2 or -(2 ** 2) to make the meaning clear.

Results grow quickly: 2 ** 1024 is already Infinity, and integers above 253 lose precision, so use BigInts, as in 2n ** 100n, when you need exact large integers. A negative exponent gives a fraction, 2 ** -2 is 0.25, and a fractional exponent gives a root, 27 ** (1/3) is roughly 3. The compound assignment form is **=.

Properties

Operator
**
Category
Arithmetic
Precedence
13 (1 is lowest, 18 is highest)
Associativity
right-to-left

Syntax

x ** y

Example

console.log(2 ** 10);
console.log(9 ** 0.5);
console.log(2 ** 3 ** 2);
console.log((-2) ** 2);
console.log(10n ** 20n);

Browser Support

The following information will show you the current browser support for the ** operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee