Bit Shift Calculator

Quick answer

The bit shift calculator shifts a binary, octal or decimal number left, logically right or arithmetically right by any number of positions in a fixed bit width, showing the bits before and after.

Result (binary)
0101 1100
Before the shift
0001 0111
Result (decimal, unsigned)
92
Result (decimal, signed)
92
Result (octal)
134

Shifting bits is the fastest way for a processor to multiply or divide by powers of two. It is used in hashing, graphics, compression, cryptography and to extract fields from packed binary data.

How to use the Bit Shift Calculator

  1. Representation
  2. Number format
  3. Number
  4. Direction
  5. Number of positions

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Choose the bit width, input format, direction and number of positions. A left shift drops bits that fall off the top; a logical right shift fills with zeros; an arithmetic right shift copies the sign bit so negative numbers stay negative.

Formula

x << n = x·2ⁿ (bits shifted out are lost) · x >>> n = ⌊x/2ⁿ⌋ (zeros enter) · x >> n keeps the sign bit

Worked example

Inputs: Representation: 8-bit; Number format: Binary; Number: 00010111; Direction: Left (<<); Number of positions: 2.
Results: Result (binary) = 0101 1100; Before the shift = 0001 0111; Result (decimal, unsigned) = 92; Result (decimal, signed) = 92; Result (octal) = 134.

Key terms

Arithmetic shift
A right shift that preserves the sign bit.

Frequently asked questions

What does a left shift by 1 do?

Doubles the number (as long as no bit falls off).

What is the difference between >> and >>>?

>> keeps the sign (arithmetic); >>> fills with zeros (logical).

What happens to bits shifted out?

They are discarded.

Is shifting faster than multiplying?

On simple processors yes; modern compilers do it automatically.

Sources

  1. Wolfram MathWorld: Binary
  2. Harvard CS50: Binary and bitwise operators

Cite this calculator

Speedy Calculator. (2026). Bit Shift Calculator. Speedy Calculator. https://speedycalculator.com/calculators/math/bit-shift/