Bit Shift Calculator
Enter unsigned binary digits and a word width. The result keeps that width; bits shifted out are discarded and empty positions receive zeros.
Formula
Left: (a × 2ˢ) mod 2ʷ. Logical right: floor(a / 2ˢ). Output has w bits.
How to use
- Enter the binary value and a sufficient width.
- Choose direction and the number of positions.
- Read the result, including its leading zeros.
Examples
- At width 8, 00101010 shifted left once becomes 01010100.
Frequently asked questions
Does right shift preserve a sign?
No. This is logical right shift; new high bits are always zero.
What if the shift count reaches the width?
The result is all zeros. The count is used literally, not reduced modulo 32 or 64.
Is shifting the same as rotation?
No. Shifted-out bits are discarded. Counts from 0 to 4096 are accepted; zero leaves the padded value unchanged.
Sources
Updated: