GCSE · Computer Science · Edexcel · Spec 1CP2

Logical binary shifts

Double 150 by shifting its bits left in 8 bits and the computer says 44. No warning, just a confident wrong answer. Where did the missing bit 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: each time every bit moves 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 before 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 think about what an 8-bit pattern can actually hold.

00001111 is 15 in denary. You shift it one place to the right in a logical shift. What is the denary value of the new pattern?

Computer Science · Data

Where did this shift go wrong?

A student shifts 00010111 two places left (a logical shift) and checks the answer in denary. Which line is where the work 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 to the left. The computer shows 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 and the answer, 00101100, was wrong because a 1 was lost.

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 along, fill the gap with 0s, and watch the value double or halve, until a bit falls off the end.

What you need to know

  • A binary shift moves every bit of a binary number some places to the left or to the right.
  • Shifting left multiplies the number by a power of 2, and shifting right divides it by a power of 2.
  • Have a goSam says: "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: it's the left shift that multiplies and the right shift that divides.

  • In a logical shift the gaps are filled with 0s: at the right-hand end for a left shift, the left-hand end for a right shift.
  • Left shift by n places multiplies by 2^n, so 00011010 (26) shifted two places left is 01101000 (104).
  • Have a goHave a go: shift 00001001 (9) two places left in a logical shift. Where do the new 0s go, and what is the denary result?

    00100100. The two 0s fill the right-hand end, and the result is 36.

    Two places left multiplies by 2^2 = 4, and 9 × 4 = 36, so the denary check agrees with the pattern.

  • Right shift by n places divides a whole number by 2^n, so 26 shifted one place right is 13, then 6.
  • Bits shifted beyond the end of the available bits are lost. They are not carried round or copied.
  • Have a goYou shift 11110000 one place left in 8 bits. What do you get, and what happens to the far-left 1?

    11100000. The far-left 1 falls off the end and is lost, and a 0 fills the gap on the right.

    A bit shifted beyond the end of the available bits is lost. It does not wrap round to refill the gap.

  • A left shift that loses a 1 gives a wrong answer, an overflow error: 10010110 shifted left once in 8 bits gives 00101100.
  • A right shift loses whatever falls off the right-hand end, so the remainder is truncated. That is why 13 becomes 6, not 6.5.
  • Overflow means a number is too large for the allocated memory. More binary digits avoid it but need more storage space.
  • To check a shift, convert the number and your answer to denary.

The big picture

A binary shift slides every bit of a number left or right. In a logical shift the gaps are filled with 0s, so each place left multiplies by 2 and each place right divides by 2, until bits fall off the end and the answer goes quietly wrong.

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. 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 is an overflow error.
4Check 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 is lost, and the gap is filled with 0s, nothing else.

🧠

Memory hook

Slide, fill, lose: slide every bit along, fill the gap with 0, and lose whatever falls off the end. In denary, 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?
Moving 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?
It multiplies the number by 2^n.
What does a logical right shift by n places do to a whole number?
It divides the number by 2^n.
In a logical shift, what fills the gaps, and where?
0s. A left shift puts 0s in at the right-hand end; a right shift puts 0s in at the left-hand end.
What happens to bits shifted beyond the end of the available bits?
They are lost. They are not carried round or copied.
Why does a right shift truncate?
The bits that fall off the right-hand end are lost, and they were the remainder of the division.
What is an overflow error in a left shift?
The result is too large for the bits available, so a 1 is lost 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 is the cost?
Allocating more binary digits helps avoid overflow, but they need more storage space.
How do you check a binary shift?
Convert the number and the answer to denary and compare.
A left shift gives a result that is not the original times a power of 2. What might have gone wrong?
A 1 fell off the left-hand end (overflow), or the gap was filled with something other than 0.
10010110 shifted left once in 8 bits: what do you get, and is it right?
00101100, which is wrong. A 1 was lost off the left-hand end.

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 9 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.