Binary Shift
Enter or generate an 8-bit number, choose a direction and how many places to shift: see every step of the working and the effect on the denary value.
8-bit binary number
= 107 decimal | 0x6B
Shift direction
Number of places
1Working Out
27=128
bit 7
26=64
bit 6
25=32
bit 5
24=16
bit 4
23=8
bit 3
22=4
bit 2
21=2
bit 1
20=1
bit 0
Teal bits = zeros shifted in from the right.
Faded bits = bits that fell off the edge and are permanently lost.
2Summary
Original
107
01101011
3 left shifts
⚠ overflowResult
88
01011000
Mathematical working:
Left shift by 3 places = × 23 = × 8
Expected result: 107 × 8 = 856
856 > 255: does not fit in 8 bits.
8-bit result: 856 mod 256 = 88
The high-order bits that didn't fit were lost, so the result is smaller than expected. This is called overflow.
Why left shift = ×2?
Each bit position has double the place value of the one to its right (1, 2, 4, 8…). Moving every bit one place left doubles each bit's contribution, so the total doubles. Shifting left by n places multiplies by 2n.
Why right shift = ÷2?
Moving every bit one place right halves each bit's place value. The LSB is lost, so odd numbers lose the remainder (equivalent to integer/floor division). Shifting right by n places divides by 2n.