GCSE · Computer Science · Edexcel · Spec 1CP2
Logical binary shifts
Double 150 by shifting its bits left in 8 bits and you get 44. The shift followed every rule. So where did the rest of the number go?
Computer Science · Data
Slide the bits along
One 8-bit number, shifted one place at a time. Watch where the 0s step in and which bit falls off the end.
Before you step through: every time all the bits move one place left, what do you think happens to the denary value?
1 START: 000110102 SHIFT LEFT 1 place3 SHIFT LEFT 1 place again4 START AGAIN: 000110105 SHIFT RIGHT 1 place6 SHIFT RIGHT 1 place again
| 8-bit pattern | Denary | What fills the gap | Bit that falls off |
|---|---|---|---|
| 00011010 | 26 | - | - |
Output
Step 1: Eight boxes, eight bits, and that never changes. This pattern is 16 + 8 + 2 = 26.
Press Next to move one place at a time, and compare each row with the one above it.
Predict, then check
Work it out as a division first. Then ask what an 8-bit whole-number pattern can actually hold.
00001111 is 15. Shift it one place right in a logical shift. What's the denary value now? Commit before you look.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Slide the bits, fill the gap with 0s, and the value doubles or halves. Until a bit falls off the end.
What you need to know
- A binary shift slides every bit of a binary number a set number of places to the left or right.
- Left multiplies the number by a power of 2; right divides it by a power of 2. Same slide, opposite job.
Have a goYour mate Sam is certain: "Shifting right makes a number bigger, because the bits are heading towards the big end." Is Sam right?
No. A right shift divides by a power of 2, so the number gets smaller.
Sam has the directions swapped: moving the bits left multiplies, and moving them right divides, so the number gets smaller.
- In a logical shift every gap fills with 0s: at the right-hand end for a left shift, the left-hand end for a right shift.
- Shift left n places to multiply by 2^n: 00011010 (26) shifted two places left is 01101000 (104).
Have a go00000110 is 6. Without writing out any bits, what denary value do you get after shifting it two places left?
24
Two places is two doublings, so ×2² = ×4, and 6 × 4 = 24. Just doubling once (12) only counts one of the places.
- Shift right n places to divide a whole number by 2^n: 26 shifted right once is 13, and once more is 6.
- Bits pushed past the end of the available bits are lost. They never wrap round, and they're never copied.
Have a goYou shift 11110000 one place left in 8 bits. What pattern do you get, and where does the far-left 1 end up?
11100000. The far-left 1 is lost and a 0 fills the right-hand end.
The far-left 1 is pushed past the end of the 8 bits, so it's lost. It doesn't wrap round to fill the gap; a 0 does that.
- On a right shift, the bits that fall off are the remainder, so it's truncated: 13 becomes 6, not 6.5.
- Lose a 1 off the left-hand end and the answer is wrong, an overflow error: 10010110 shifted left once gives 00101100.
- Overflow means a number is too large for its allocated memory. More bits help avoid it, but cost more storage space.
- Check any shift by converting the starting number and your answer to denary.
The big picture
A binary shift slides every bit of a whole number left or right. In a logical shift the gaps fill with 0s, so each place left doubles the value and each place right halves it. Bits pushed past the end are lost: on the right that loses the remainder, and on the left it can lose a 1 and cause an overflow error.
Key points
Worked example
Problem
Shift 00001011 (11) two places left, and separately shift 00001011 two places right. Check both answers in denary.
⚠ Watch out
Thinking a bit that falls off the end wraps round to the other end, or is kept somewhere. In a logical shift it's lost, and the gap fills with 0s, nothing else. That's also why 'left shift = multiply' only holds while no 1 falls off.
Memory hook
Slide, fill, lose: slide every bit along, fill the gap with 0, and lose whatever falls off the end. You already know this trick in denary, where sliding the digits multiplies or divides by 10. In binary, each slide is a 2.
Check yourself
Shift 00000111 two places left in a logical shift, then check your answer in denary. (Answer: 00011100, which is 28 = 7 × 4.)
Flashcards
(12)What is a binary shift?
What does a logical left shift by n places do to the value?
What does a logical right shift by n places do to a whole number?
In a logical shift, what fills the gaps, and where?
What happens to bits shifted beyond the end of the available bits?
Why does a right shift truncate?
What causes an overflow error in a left shift?
What is overflow?
How do more bits help with overflow, and what's the catch?
How do you check a binary shift?
A left shift gives a result that isn't the original times a power of 2. What might have gone wrong?
10010110 (150) shifted left once in 8 bits: what do you get, and is it double?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore Edexcel GCSE Computer Science topics
How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 26 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.