A-Level Computer Science / Unit 1: Representing Information

1.1.1 Binary, Denary and Hexadecimal

πŸ”’ Lesson slides are available to signed-in users. Sign in

1.1A Binary, Denary and Hexadecimal

In this lesson, you will learn how computers represent numbers using different number systems. We will focus on denary, binary, and hexadecimal.

By the end of this section, you should be able to:

  • Explain what denary, binary, and hexadecimal number systems are.
  • Understand the importance of place value.
  • Convert binary numbers to denary.
  • Convert denary numbers to binary.
  • Explain why hexadecimal is useful in computer science.

Denary Numbers

The denary number system is the number system we use in everyday life. It is also called the decimal system.

It is a base-10 system, which means it uses ten different digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

Denary (Decimal): a base-10 number system that uses the digits 0–9.
Exam tip: When a question asks about a number system, include the base and the digits used. For denary, this means base 10 and the digits 0–9.

Place Value

The value of a number depends on the position of each digit. Each position represents a power of 10.

Starting from the right, the place values increase as:

1, 10, 100, 1000, ...

This means that each step to the left is worth ten times more than the previous one.

Example

Consider the number 572.

Place value 100 10 1
Digit 5 7 2
Value 500 70 2

So the number can be written as:

572 = 500 + 70 + 2

This shows how each digit contributes to the overall value depending on its position.

Binary Numbers

Binary is a base-2 number system. This means it only uses two digits: 0 and 1.

Bit: one binary digit, either 0 or 1.
Common mistake: Do not confuse a bit with a byte. A bit is one binary digit, while a byte is a group of eight bits.

Like denary numbers, binary numbers use place value. However, instead of powers of 10, binary uses powers of 2.

For example, the binary number 110101 can be broken down like this:

Place value 32 16 8 4 2 1
Binary digit 1 1 0 1 0 1
Value 32 16 0 4 0 1

So 110101β‚‚ = 32 + 16 + 4 + 1 = 53₁₀.

Computers use binary because computer hardware is designed around two possible states, such as on/off or true/false. These two states can be represented naturally using 1 and 0.

Exam tip: If asked why computers use binary, link your answer to hardware states. A strong answer mentions that 0 and 1 can represent two physical states, such as off and on.
Byte: eight bits handled together as a standard data unit.

Binary data is often organised into groups of eight bits. For example: 01101001 is one byte.

Hexadecimal Numbers

Hexadecimal is a base-16 number system. This means it uses sixteen different symbols to represent values.

The digits 0–9 are used as usual, and the letters A–F are used to represent values greater than 9.

Hex 01234 56789 ABCDEF
Denary 01234 56789 101112131415

Like other number systems, hexadecimal uses place values. Each position represents a power of 16, so moving one place to the left increases the value by a factor of 16.

Nibble: a four-bit group that corresponds to one hexadecimal digit.
Common mistake: One hexadecimal digit represents four bits, not eight bits. A full byte needs two hexadecimal digits.

A single hexadecimal digit corresponds exactly to four binary digits. Because of this, hexadecimal provides a more compact way of writing binary values.

Since a byte contains eight bits, it can be represented using two hexadecimal digits.

Binary Hexadecimal Denary
00101100 2C 44
11001010 CA 202

When working on paper, leading zeros in binary are often omitted. However, when data is stored in a computer, each byte must always contain eight bits, so zeros may be added at the beginning to keep the correct length.

Hexadecimal is widely used in computing because it is easier for humans to read and write than long binary sequences. It is commonly seen in memory addresses, error codes, and data representations such as colour values.

Exam tip: When explaining why hexadecimal is used, focus on readability and compactness. Avoid saying that the computer stores data in hexadecimal; computers still store data using binary.

Try it yourself: Number System Converter

Type a value in one box. The other number systems will update automatically.

Exam tip: Use the converter to check your work, but practise the written method as well. In an exam, marks are often awarded for showing the correct process.

Conversions

Binary to denary

To convert binary to denary, add the place values where the binary digit is 1.

Common mistake: Only add the place values with a 1 above them. Place values with a 0 do not contribute to the total.

Example: 1011010β‚‚ = 64 + 16 + 8 + 2 = 90₁₀.

Denary to binary

To convert denary to binary, find the largest power of 2 that fits into the number, subtract it, and repeat until the number is fully represented.

Example: 93₁₀ = 64 + 16 + 8 + 4 + 1, so 93₁₀ = 1011101β‚‚.

Binary to hexadecimal

To convert binary to hexadecimal, split the binary number into groups of four bits from the right, then convert each group into one hexadecimal digit.

Exam tip: In written answers, show the groups of four bits clearly. This makes your method easier to follow and reduces mistakes.

Interactive: Denary and Binary Step Visualiser

Use this tool to see how a denary number is changed into binary. You can compare two common methods: repeated division by 2, or selecting powers of 2.

Exam tip: In conversion questions, show the working method. A final answer alone may not be enough if the question asks you to show your steps.

Divide the number by 2 until the quotient is 0. The binary answer is found by reading the remainders from bottom to top.
Result: --

Interactive: Binary to Hexadecimal

Enter a binary value. The tool will group the bits into nibbles and show how each group becomes one hexadecimal digit.

Common mistake: When converting binary to hexadecimal, group the bits from the right. Add leading zeros only when they are needed to complete a group of four bits.

Enter a binary value to see the nibble groups.
Nibble 1 ---- ?
Nibble 2 ---- ?
Hexadecimal result: --

Interactive: Denary to Hexadecimal

Enter a denary number. The tool divides by 16 step by step and shows how the hexadecimal answer is formed from the remainders.

Exam tip: The remainders are produced from top to bottom, but the hexadecimal answer is read from bottom to top.

Step Division Quotient Remainder Hex digit
Read the hex digits from bottom to top: --

Practice

Try these questions

  1. Convert 111000β‚‚ to denary.
  2. Convert 86₁₀ to binary.
  3. Convert 10110111β‚‚ to hexadecimal.
  4. Convert D5₁₆ to denary.
  5. Explain why hexadecimal is useful for representing binary data.