Right Arithmetic Shift Calculator

Written by:
PK

Use this right arithmetic shift calculator to shift bits right while preserving the sign bit. This operation effectively divides by powers of 2 while keeping negative numbers negative.

Right arithmetic shift calculator

Using the calculator

Enter the number to shift and select an input format: Decimal, Hex, Binary, or Octal. You can also type prefixes directly (0xFF for hex, 0b1010 for binary, or 0o17 for octal) and the tool will auto-detect the format. The positions field is always in decimal.

The result displays in all formats simultaneously: decimal (signed and unsigned), hexadecimal, octal, and a 32-bit binary representation with spaces every 8 bits for readability.

How right arithmetic shift works

Right arithmetic shift (>>) moves all bits to the right by a specified number of positions. The key difference from logical shift: it preserves the sign bit. The leftmost bit (sign bit) is copied into the vacated positions, so negative numbers stay negative.

Each position shifted right effectively divides the number by 2, rounding toward negative infinity:

x \gg n = \lfloor x \div 2^n \rfloor

Right arithmetic shift examples

Positive number

44 \gg 2 = 11

Shifting 44 right by 2 positions divides it by 4 (2²). In binary:

0010110000001011

Negative number

-44 \gg 2 = -11

For negative numbers, the sign is preserved. The leftmost 1s (indicating negative in two's complement) are maintained as the bits shift right. This is the key difference from right logical shift, which would fill with 0s and produce a large positive number.

Related calculators

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram