Menu

Binary and Hexadecimal Basics

Hexadecimal

Hexadecimal is a number system with base 16. It uses sixteen digits: 0 to 9 and then A to F. The letters A to F continue the count after 9: A is ten, B is eleven, C is twelve, D is thirteen, E is fourteen and F is fifteen. Every value from 0 to 15 therefore has a single hexadecimal digit, and it also fits in a 4-bit binary pattern. For example, denary 6 is 0110 in 4 bits and 6 in hexadecimal, while denary 12 is 1100 in 4 bits and C in hexadecimal.

Each hexadecimal digit represents exactly one nibble, which is 4 bits. A byte is 8 bits, so one byte is written as two hexadecimal digits, not one. For example, the two-digit hexadecimal number 7A represents one byte.

Binary 1011010111 split into groups of four from the right (10, 1101, 0111), padded to 0010 1101 0111, with each group swapped for a hexadecimal digit to give 2D7.

Place values

In a two-digit hexadecimal number, the left digit counts 16s and the right digit counts 1s. For example, in 3C the 3 counts three 16s and the C counts twelve 1s. This is why hexadecimal is base 16: each place value is 16 times the place value to its right.

Why hexadecimal is useful

Hexadecimal is shorter than binary: eight binary digits become just two hexadecimal digits. This makes it easier for humans to read, remember and type than long binary patterns, so fewer errors are made. It also converts easily to and from binary because each hexadecimal digit is exactly one nibble.

Hexadecimal does not make a file or memory smaller. Inside the machine the data remains binary; hexadecimal is just a convenient display for people. People use it when they need a readable way to inspect or enter binary data, such as memory addresses in a crash report or raw values in a file viewer.

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