## Teach Any Computer Science Class

We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.

Whether you're a brand new Computer Science teacher, or you've been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the Lessons →### Binary Numbering System

Binary is a base 2 numbering system made up of two numbers: 0 and 1. 0 represents OFF and 1 represents ON. A computer’s central processing unit (CPU) only recognises these two states. It’s the foundation for all binary code, which is used in computer and digital systems.

### Bits and Bytes

A binary digit called a bit is the smallest unit of data in a computer. Each bit has a single value, which is either 0 or 1. 8 bits (b) is equivalent to 1 byte (B).

### Hexadecimal Numbering System

Hexadecimal is a base 16 numbering system made up of 16 digits: 0 – 9 and six more characters, which are A through F.

### Uses of Hexadecimal

Programmers often use the hexadecimal numbering system to simplify the binary numbering system. As 16 is equivalent to 24, there is a linear relationship between the numbers 2 and 16. This means that one hexadecimal digit is equivalent to four binary digits. Computers use the binary numbering system while humans use the hexadecimal numbering system to shorten binary and make it easier to understand.

### Conversion from Binary to Hexadecimal

Conversion can be done in two ways:

**1. Basic Conversion** – this is used for binary numbers with four or less digits.

a) Start with four binary numbers to convert. If the binary has less than 4 digits, just add zeros to the front to make it 4 digits.

- Example: 1010
- If you have 01, make it 0001.

b) Put the binary number in the power of 2 columns as follows:

Exponent | 23 | 22 | 21 | 20 |

Value | 8 | 4 | 2 | 1 |

Binary | 1 | 0 | 1 | 0 |

c) Take the corresponding value of each binary digit equal to 1 and add to get the total value. The total value corresponds to the decimal equivalent.

- Total value = (8 + 2) = 10
- So the binary number 1010 is 10 in the decimal number system.

d) Convert decimal to hexadecimal.

- The decimal number 10 is A in hexadecimal. Refer to the table below.
- So the binary number 1010 is equivalent to A in hexadecimal.

Hexadecimal | Decimal |

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

A | 10 |

B | 11 |

C | 12 |

D | 13 |

E | 14 |

F | 15 |

**2. Conversion of long binary numbers** is used for binary numbers with more than four digits.

a) Break the string of binary numbers into groups of four, from right to left. If the leftmost binary has less than 4 digits, add zeros to the front to make it 4 digits.

Example: 11101100101001

11 1011 0010 1001

(0011) (1011) (0010) (1001)

b) Convert each group at a time using the Basic Conversion method discussed earlier.

0011 = (2 + 1) = 3

1011 = (8 + 2 + 1) = 11 = B

0010 = 2

1001 = (8+1) = 9

c) Put together the converted values of each group.

- Therefore, the binary number 11101100101001 is 3B29 in hexadecimal.

### Conversion from Hexadecimal to Binary

Conversion can be done by converting each hexadecimal digit to 4 binary digits based on the following table:

Hexadecimal | Binary |

0 | 0000 |

1 | 0001 |

2 | 0010 |

3 | 0011 |

4 | 0100 |

5 | 0101 |

6 | 0110 |

7 | 0111 |

8 | 1000 |

9 | 1001 |

A | 1010 |

B | 1011 |

C | 1100 |

D | 1101 |

E | 1110 |

F | 1111 |

Example: For 3B29, convert each digit as follows:

3 is converted to 0011

B is converted to 1011

2 is converted to 0010

9 is converted to 1001

So the hexadecimal number 3B29 is equivalent to 0011101100101001 in binary.