Menu

Binary and Hexadecimal Basics

Binary Values and Ranges

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.

A tree splits into 0 and 1 at each level: 1 bit gives 2 patterns, 2 bits give 4 and 3 bits give 8, from 000 to 111. Each extra bit doubles the count.

Counting patterns and the largest value

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 bitsNumber of patterns (2 to the power n)Values represented
380 to 7
5320 to 31
6640 to 63
1010240 to 1023

The 8-bit range

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.

Practise this

OCR GCSE Computer Science · Binary and Hexadecimal Basics

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