Skip to content
FiftyCalc Free calculators for all 50 states

Bit Shift Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter a non-negative whole number, the number of positions and the direction of the shift.

Result

Sample figures

Result in decimal—

n in binary (shown up to 16 digits) —

  • Result in binary (shown up to 16 digits)—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Bit Shift Calculator

Number n (decimal, 0 to 4,294,967,295): enter 0 or more. Prefilled example: 13.

Shift by k positions (0 to 32): enter a number from 0 to 32. Prefilled example: 2.

Direction

Direction: choose Left shift (n << k) or Right shift (n >> k). Prefilled example: Left shift (n << k).

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Number n (decimal, 0 to 4,294,967,295): enter 0 or more.
  2. Shift by k positions (0 to 32): enter a number from 0 to 32.
  3. Direction: choose Left shift (n << k) or Right shift (n >> k).
  4. Read the result: Result in decimal; the panel also shows n in binary (shown up to 16 digits) and Result in binary (shown up to 16 digits).

How this calculator works

A left shift by k moves every bit k places to the left and fills with zeros: n << k = n × 2ᵏ. A logical right shift drops the last k bits: n >> k = floor(n ÷ 2ᵏ).

The calculator works on non-negative whole numbers without a fixed width, so a left shift never overflows here; in a 32-bit register, bits pushed past the top would be lost.

Worked example

Number n (decimal, 0 to 4,294,967,295)13
Shift by k positions (0 to 32)2
DirectionLeft shift (n << k)
Result in decimal52
n in binary (shown up to 16 digits)1101
Result in binary (shown up to 16 digits)110100

Frequently asked questions

What is 13 << 2?

52: 1101 becomes 110100, which is 13 × 4.

What is 200 >> 3?

25: 11001000 becomes 11001, which is 200 ÷ 8.

Related calculators