Hexadecimal

GCSE Computer Science · Data Representation

What hexadecimal is

Hexadecimal (hex) is a base-16 number system. Everyday numbers use base 10 (digits 0–9); binary uses base 2 (0 and 1); hex uses sixteen symbols: 0 1 2 3 4 5 6 7 8 9 A B C D E F.

The letters stand for the denary values that are too big for a single digit:

DenaryBinaryHexDenaryBinaryHex
000000810008
100011910019
200102101010A
300113111011B
401004121100C
501015131101D
601106141110E
701117151111F

Why hex is used

Computers work in binary, but long binary strings are hard for people to read and easy to mis-copy. Hex is a compact, human-friendly shorthand:

  • One hex digit = exactly 4 bits (one nibble).
  • Two hex digits = 1 byte (8 bits).

So the byte 11111010 becomes just FA — far quicker to read, write and spot errors in. You'll see hex in:

  • Colour codes#FF0000 is red (FF = 255 red, 00 green, 00 blue).
  • Memory addresses — e.g. 0x7FFF.
  • MAC addresses — e.g. 00:1B:44:11:3A:B7.
  • Error/debugging codes and machine code.

Converting between the bases

Binary → Hex

Split the binary into nibbles of 4 bits (from the right), then convert each nibble:

1111 1010
 F    A     →  FA

If the left-hand group has fewer than 4 bits, pad with leading zeros: 1011100010 11102E.

Hex → Binary

Convert each hex digit into its 4-bit group:

2 D  →  0010 1101

Hex → Denary

Multiply the first digit by 16 and add the second:

2D = (2 × 16) + 13 = 32 + 13 = 45

Denary → Hex

Divide by 16. The whole-number answer is the first digit; the remainder is the second:

45 ÷ 16 = 2 remainder 13  →  2D

Worked example

Convert the byte 11001111 to hex.

1. Split into nibbles: 1100 1111

2. Convert: 1100 = 12 = C, 1111 = 15 = F

3. Answer: CF

Common mistakes

  • Forgetting to pad the left nibble with zeros (e.g. writing 101 as 5 from 1 01 instead of 0101).
  • Mixing up that A = 10, not 1, and F = 15, not 16.
  • Splitting nibbles from the left instead of the right on odd-length binary.

Exam tips

  • Memorise the four "letter" values: A=10, B=11, C=12, D=13, E=14, F=15.
  • Most hex questions are just two separate nibble conversions joined together — do them one nibble at a time.
  • Show the nibble split in your working; you often get a mark for method even if the final digit is wrong.

Key facts to remember

  • Hex is base 16; digits 0–9 then A–F.
  • 1 hex digit = 4 bits (a nibble); 2 hex digits = 1 byte.
  • Used for colour codes, memory/MAC addresses and machine code because it is shorter and less error-prone than binary.
Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

More on Data Representation

Binary and Denary Binary Arithmetic and Shifts Characters, Images and Sound Compression

← All GCSE Computer Science notes