### Preview lessons, content and tests

#### Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.

2. Searching for something specific? See our text overview of all tests. Scroll right for levels, and lists.

3. Student and Teacher User Guides |  Schemes of Work |   Real Teacher use Videos |

Join 36000+ teachers and students using TTIO.

### Binary Shift

Binary shifting is just as its name suggests; we are shifting or moving binary values left or right. Each 1 or 0 is called a bit; which is short for Binary digIT. BIT: The smallest unit of data in a computer. Scroll down to find out more about why we use them in the first place!

### What is the purpose of Binary Shifting?

Binary numbers are multiplied and divided through a process called shifting.

A binary shift one bit to the left causes all the bits to move one place to the left and the leftmost bit to be discarded.This is essentially the same result as multiplying a number by 2. Similarly, if you want to multiply a number by 16 (24), you can perform a binary shift to the left four times.

Similarly, a binary shift one bit to the right causes all the bits to move one place to the right and the rightmost bit to be discarded. A `0` will move into the empty place on the left. This is essentially the same result as dividing a number by 2. Similarly, if you want to divide a number by 32 (25), you can perform a binary shift to the right five times.

Note: A normal bit shift operation is sometimes called a logical shift, because it treats the byte as a set of independent logical bits. The alternative is an arithmetic shift, which treats the byte as a number.

www.teachyourselfpython.com