Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Unsigned right shift (>>>)

The >>> operator shifts a number’s 32-bit representation to the right, inserting zeros on the left. It returns a nonnegative Number, and the shift count is reduced modulo 32. It does not support BigInt.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

value >>> shiftCount

The operator value >>> shiftCount discards low-order bits on the right and fills vacated positions on the left with zeros. The result is a Number from 0 to 4294967295, not a separate unsigned integer type. Unlike >>>, the >> operator preserves the sign by copying the highest-order bit.

For Number operands, both arguments undergo ToUint32: fractional parts are truncated toward zero and values wrap modulo 2 ** 32; NaN and infinities become zero. The shift count is then reduced modulo 32, so value >>> 33 behaves like value >>> 1.

The expression value >>> 0 shifts no bits but still performs unsigned 32-bit conversion. It is therefore not a safe way to preserve arbitrary large integers. The operator does not support BigInt: both 1n >>> 0n and mixing BigInt with Number cause a TypeError.

In the example, value is -8. The operation >>> 1 produces 2147483644, whereas >> 1 produces -4. The remaining results demonstrate conversion without shifting and reduction of the shift count modulo 32.

Examples

const value = -8;
console.log(value >>> 1);
console.log(value >> 1);
console.log(value >>> 0);
console.log(value >>> 33);

Result

2147483644
-4
4294967288
2147483644

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources