Binary and Hexadecimal Basics
A bit is a single binary digit, so it has only two patterns: 0 or 1. Adding a second bit lets each pattern so far be extended with a 0 or a 1, so the count of patterns doubles. Add a third bit and it doubles again. That is why the number of binary patterns grows by a factor of two with every extra bit.
For n bits, the number of different patterns is 2 to the power n. Counting starts at zero, so the largest value is 2 to the power n minus 1: one of the patterns is spent on zero, which puts the top value one below the total count.
For example, 12 bits give 2 to the power 12 = 4096 patterns, running from 0 to 4095, so 12 bits are enough for any whole number smaller than 4096.
| Number of bits | Number of patterns (2 to the power n) | Values represented |
|---|---|---|
| 3 | 8 | 0 to 7 |
| 5 | 32 | 0 to 31 |
| 6 | 64 | 0 to 63 |
| 10 | 1024 | 0 to 1023 |
With 8 bits there are 2 to the power 8 = 256 patterns, so the denary values run from 0 to 255. The same range written in binary is 00000000 to 11111111, and in hexadecimal it is 00 to FF.
Only positive whole numbers are covered here: negative numbers, two's complement, sign and magnitude and binary fractions are not required.
OCR GCSE Computer Science · Binary and Hexadecimal Basics
OCR GCSE Computer Science · Binary to Denary Conversion
OCR GCSE Computer Science · Denary to Binary Conversion
OCR GCSE Computer Science · Hexadecimal to Binary Conversion
OCR GCSE Computer Science · Binary to Hexadecimal Conversion
OCR GCSE Computer Science · Denary to Hexadecimal Conversion
OCR GCSE Computer Science · Hexadecimal to Denary Conversion