Binary and data representation - EdexcelHexadecimal notation

All data in a computer is represented in binary, whether it is numbers, text, images or sound. The computer software processes the data according to its content.

Part ofComputer SciencePrinciples of computer science

Hexadecimal notation

In computer science, different number bases are used:

  • is base 10, which has ten symbols (0-9)
  • is base 2 , which has two symbols (0-1)

, also known as hex, is the third commonly-used number system and is base 16. It has 16 symbols - 0-9 and the capital letters A, B, C, D, E and F.

DenaryBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
Denary0
Binary0000
Hexadecimal0
Denary1
Binary0001
Hexadecimal1
Denary2
Binary0010
Hexadecimal2
Denary3
Binary0011
Hexadecimal3
Denary4
Binary0100
Hexadecimal4
Denary5
Binary0101
Hexadecimal5
Denary6
Binary0110
Hexadecimal6
Denary7
Binary0111
Hexadecimal7
Denary8
Binary1000
Hexadecimal8
Denary9
Binary1001
Hexadecimal9
Denary10
Binary1010
HexadecimalA
Denary11
Binary1011
HexadecimalB
Denary12
Binary1100
HexadecimalC
Denary13
Binary1101
HexadecimalD
Denary14
Binary1110
HexadecimalE
Denary15
Binary1111
HexadecimalF

Hexadecimal is useful because large numbers can be represented using fewer digits. For example, colour values and are often represented in hexadecimal.

Additionally, hexadecimal is easier to understand than binary. Programmers often use hexadecimal to represent binary values as they are simpler to write and check than when using binary.

Converting between binary and hexadecimal

The simplest way to convert from binary to hexadecimal, and vice versa, is to split the binary number into nibbles (four ) first, then convert each nibble to hexadecimal. A nibble can hold 16 values in its 4 bits so is useful for converting hexadecimal.

Binary to hexadecimal

  1. Start at the rightmost digit and break the binary number into nibbles.
  2. Next, convert each nibble into hexadecimal
  3. Put the hexadecimal digits together.

Example: 11000011 to hexadecimal

Break into nibbles: 1100 0011.

1100 = hexadecimal C and 0011 = hexadecimal 3. Remember, this is hexadecimal base 16 symbol 3, not denary symbol 3.

Result: C3

Example: 00110011 to hexadecimal

Break into nibbles: 0011 0011.

0011 = hexadecimal 3 and 0011 = hexadecimal 3

Result: 33

Hexadecimal to binary

  1. Split the hexadecimal number into individual digits.
  2. Convert each hexadecimal digit into its binary equivalent (a nibble).
  3. Combine the nibbles to make one binary number.

Example: hexadecimal 28 to binary

2 = binary 0010 and 8 = binary 1000

Result: 00101000

Example: hexadecimal FC to binary

F = binary 1111 and C = binary 1100

Result: 11111100

Question

What would these hexadecimal numbers be in binary?

  1. 11
  2. 2B
  3. AA

Converting between binary and hexadecimal numbers