Favorites

JavaScript << Left shift Operator

☕
Enjoying this site?

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

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

The left shift operator (<<) moves the bits of an integer to the left, which multiplies it by a power of two.

Description

The left shift operator << shifts the bits of the left operand (as a 32-bit integer) left by the given number of places, filling with zeros. Shifting by n multiplies by 2n, as long as the result fits in 32 bits.

Shifting is a fast way to build bit masks, as in 1 << n to set bit n. Only the lowest five bits of the shift count are used, so shifting by 32 is the same as shifting by 0. Because results are 32-bit signed integers, shifting a 1 into the top bit produces a negative number, as 1 << 31 shows.

For multiplication by powers of two in ordinary code, * or ** are clearer and don't have the 32-bit limit. BigInts can be shifted too, with no size limit, as long as both operands are BigInts.

Properties

Operator
<<
Category
Bitwise
Precedence
10 (1 is lowest, 18 is highest)
Associativity
left-to-right

Syntax

x << y

Example

console.log(1 << 3);
console.log(5 << 1);
console.log((1 << 31));

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