Math

Bit Shift Calculator

Shift an integer's bits left or right.

Parameters Live Compute
Calculated Output
Result (decimal) 20
Result (binary) 10100
Formula: left shift ×2ⁿ, right shift ÷2ⁿ
Step-by-Step Breakdown
1. Values used:
2. Value (decimal) = 5
3. Shift amount = 2
4.
5. Result (decimal) = 20
6. Result (binary) = 10100
Did this calculator solve your problem today?
Report issue to loopingon.com
Sponsored

Shifting bits left or right is a fast way to multiply or divide by powers of two.

The math behind it

A left shift by n multiplies by 2ⁿ; a right shift by n divides by 2ⁿ (discarding remainder bits).

Worked Example

5 (101) << 2 = 20 (10100).

Frequently Asked Questions

Why use bit shifts?

They are much faster than multiplication or division on most processors.

Advertisement