Favorites

JavaScript >> Right 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 right shift operator (>>) moves the bits of an integer to the right, keeping the sign, which divides it by a power of two.

Description

The right shift operator >> shifts the bits of a 32-bit integer to the right, copying the sign bit into the left so negative numbers stay negative. Shifting by n divides by 2n, rounding down.

Because the sign bit is copied in from the left, >> is also called the sign-propagating or arithmetic right shift. For positive numbers, x >> 1 is the same as Math.floor(x / 2); for negative numbers it rounds towards negative infinity, so -7 >> 1 is -4.

It's used to extract parts of packed values, for example getting the red channel from a 24-bit colour with (color >> 16) & 255. Only the lowest five bits of the shift amount are used.

Properties

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

Syntax

x >> y

Example

console.log(16 >> 2);
console.log(-16 >> 2);
console.log(7 >> 1);

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