Number Systems · Cambridge syllabus 1.1 · Lesson 4 of 5
Binary Shifts
A logical left shift moves bits towards higher place values and fills the right with zeros. A logical right shift moves bits towards lower place values and fills the left with zeros. Bits that leave the register are discarded.
By the end, you can
- Perform logical left shifts on positive 8-bit binary integers.
- Perform logical right shifts.
- Perform multiple shifts.
- Understand that bits shifted out of the register are lost.
- Understand that zeros are shifted into the opposite end.
- Explain how a left shift changes the binary value.
- Explain how a right shift changes the binary value.
- Relate shifts to multiplication or division by powers of two where appropriate.
Logical shifts
A logical shift moves every bit a stated number of places left or right. Zeros are fed in at the vacated end, and any bits pushed off the other end are discarded.
Shifting 00010110 two places left gives 01011000. The two leading zeros were pushed off and two zeros came in on the right.
The word logical matters: an arithmetic shift preserves the sign bit, and that is a different operation. At this level shifts are logical unless a question says otherwise.
Worth remembering
- Every bit moves; zeros fill the vacated end; bits pushed off are lost.
Effect of shifts
A left shift of one place multiplies the value by 2, and a right shift of one place divides it by 2. Shifting n places multiplies or divides by 2ⁿ.
That is not a coincidence — it is the same reason shifting a denary number left multiplies by 10. Each bit moves into a column worth twice as much.
So 00010110, which is 22, shifted two places left becomes 01011000, which is 88 — that is 22 × 4.
Two effects have to be mentioned when they occur. Shifting left can push a 1 off the end, which loses data and makes the result wrong: the value has overflowed. Shifting right discards any 1s pushed off, so division truncates — 7 shifted right once gives 3, not 3.5.
Shifting is used because it is much faster than a general multiply or divide, so compilers replace multiplication by a power of two with a shift.
Worth remembering
- Left shift of n multiplies by 2ⁿ; right shift divides by 2ⁿ.
- Bits pushed off the left are lost, so the answer overflows.
- Right shifts truncate: 7 ÷ 2 gives 3.
Worked example
00101100₂ shifted left once becomes 01011000₂: 44 becomes 88. Shift right once gives 00010110₂: 22.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
The leading 1 is discarded and a zero enters at the right: 00000010₂, representing 2.
Check your method, units and explanation against it.
Marked practice
Set 1 of 4 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.