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: 00011010
2 SHIFT LEFT 1 place
3 SHIFT LEFT 1 place again
4 START AGAIN: 00011010
5 SHIFT RIGHT 1 place
6 SHIFT RIGHT 1 place again
8-bit patternDenaryWhat fills the gapBit that falls off
0001101026--

Output

 

Step 1: Eight boxes, eight bits, and that never changes. This pattern is 16 + 8 + 2 = 26.

1 / 6

Press Next to move one place at a time, and compare each row with the one above it.

Step 1 of 6: Eight boxes, eight bits, and that never changes. This pattern is 16 + 8 + 2 = 26..

Watch out: Left or right, a bit that falls off the end is gone for good. It doesn't wrap round and it isn't copied.

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.

Computer Science · Data

Where did this shift go wrong?

A student shifts 00010111 two places left (a logical shift) and checks in denary. The check fails. Which line is where it first goes wrong?

A student's answer — which line goes wrong?

Computer Science · Data

A 1 shifted past the end

An 8-bit number, 10010110, is shifted one place left in a logical shift. The result is 00101100.

What happened to the 1 that started at the far left-hand end?
How sure are you?

Computer Science · Data

Explain it in your own words

Earlier, 10010110 was shifted one place left in 8 bits. The result, 00101100, was wrong as a doubling because a 1 was lost off the left-hand end.

Explain what overflow is, and why allocating more bits helps to avoid it but has a cost. [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

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

1A logical shift slides every bit along and fills the gaps with 0s: at the right-hand end for a left shift, at the left-hand end for a right shift.
2Shifting left by n places multiplies by 2^n, as long as no 1 is lost. Shifting right by n places divides a whole number by 2^n.
3Bits shifted beyond the end are lost, never carried round or copied. A right shift truncates the remainder; a left shift that loses a 1 gives an overflow error.
4Overflow is a number too large for its allocated memory. More bits help avoid it but need more storage space.
5Check any shift by converting the number and the answer to denary.

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?
Sliding every bit of a binary number a number of places to the left or to the right.
What does a logical left shift by n places do to the value?
Multiplies it by 2^n, as long as no 1 falls off the left-hand end.
What does a logical right shift by n places do to a whole number?
Divides it by 2^n, keeping only the whole-number part.
In a logical shift, what fills the gaps, and where?
0s. A left shift puts them in at the right-hand end; a right shift puts them in at the left-hand end.
What happens to bits shifted beyond the end of the available bits?
They're lost. They are not carried round to the other end, and they are not copied.
Why does a right shift truncate?
The bits that fall off the right-hand end make up the remainder, and they're lost, so only the whole-number answer is left.
What causes an overflow error in a left shift?
The result is too large for the bits available, so a 1 is lost off the left-hand end and the answer is wrong.
What is overflow?
When a number is too large to be stored in the allocated memory.
How do more bits help with overflow, and what's the catch?
More binary digits help avoid overflow, because bigger numbers fit, but they need more storage space.
How do you check a binary shift?
Convert the starting number and your answer to denary and compare them.
A left shift gives a result that isn't the original times a power of 2. What might have gone wrong?
Either a 1 fell off the left-hand end (overflow), or a gap was filled with something other than 0.
10010110 (150) shifted left once in 8 bits: what do you get, and is it double?
00101100, which is 44, not 300. The leading 1 was lost off the left-hand end, so it's an overflow error.

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 posted

More Edexcel GCSE Computer Science topics

See the full Edexcel Computer Science curriculum →

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.