Bytesize CS

Binary shifts

Carry out the logical shift on the 8-bit number. Click the answer bits, or type 0 and 1 from left to right.

Score 0 / 0 Streak 0 Best 0

Logical shift

How to do a logical binary shift

A logical shift moves every bit the same number of places to the left or right.

  1. Move every bit the given number of places.
  2. Bits that move past the end of the byte fall off and are lost.
  3. Fill the empty places at the other end with 0s.

Left shift: each place multiplies the number by 2. Shifting left 1 place is ×2, 2 places is ×4, 3 places is ×8, and so on. If any 1s fall off the left, the answer is too big for 8 bits and the result is wrong (an overflow).

Right shift: each place divides the number by 2. Shifting right 1 place is ÷2, 2 places is ÷4, 3 places is ÷8, and so on. Any remainder is lost, because those bits fall off the right. For example, Binary 0000 1101 (Denary 13) shifted right 1 place gives Binary 0000 0110 (Denary 6), not 6.5.