x

Revision notes for Edexcel GCSE Computer Science Converting denary and 8-bit binary. Open the guide for explanations and worked examples. Written against the Edexcel GCSE Computer Science (1CP2) specification, so the content matches what's examinable rather than general Computer Science background.

Converting denary and 8-bit binary

What you'll learn

  • How denary and binary place values work.
  • How to convert unsigned 8-bit binary numbers between 0 and 255.
  • How to convert signed 8-bit two’s-complement numbers between -128 and +127.
  • How to avoid common GCSE exam mistakes with range and the leftmost bit.

The basics: denary, binary and bits

Definition

Denary and binary

Denary means base 10, the number system you normally use. Binary means base 2, so it only uses the digits 0 and 1. A bit is one binary digit. An 8-bit binary number has exactly 8 bits, often grouped as two nibbles of 4 bits, such as 1100 0100.

In denary, each column is worth 10 times the column to its right: ones, tens, hundreds, and so on.

In binary, each column is worth 2 times the column to its right. For an unsigned 8-bit number, the place values are:

128, 64, 32, 16, 8, 4, 2, 1

This means the leftmost bit is worth 128 and the rightmost bit is worth 1.

The two grids below show the key difference between unsigned 8-bit binary and signed 8-bit two’s complement.

Two 8-bit binary place-value grids showing unsigned columns 128 to 1 and two's-complement columns -128 to 1

Key Idea

Binary is about place value

To convert binary to denary, add the place values where the bit is 1. Ignore the columns where the bit is 0.

Unsigned 8-bit binary: 0 to 255

Definition

Unsigned integer

An unsigned integer is a whole number with no negative values allowed. In 8 bits, unsigned binary can represent values from 0 to 255.

Why 255? Because if all 8 bits are 1, you add every unsigned place value:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

So:

  • 0000 0000 means 0
  • 1111 1111 means 255, if it is being treated as unsigned

Converting unsigned binary to denary

Use the unsigned place-value row:

128, 64, 32, 16, 8, 4, 2, 1

For each 1, add that column’s value.

Example

Converting unsigned binary to denary

Convert 0101 1011 to denary.

  1. Write the place values above the bits: 128, 64, 32, 16, 8, 4, 2, 1.

  2. Match the 1 bits to their place values: 0101 1011 has 1s in the 64, 16, 8, 2 and 1 columns.

  3. Add those values: 64 + 16 + 8 + 2 + 1 = 91.

  4. So 0101 1011 is 91 in denary.

Converting denary to unsigned binary

To convert a denary number to unsigned 8-bit binary, work from left to right.

At each place value, ask: “Can I subtract this value without going below 0?”

  • If yes, write 1 and subtract it.
  • If no, write 0 and move on.
Example

Converting denary to unsigned binary

Convert 196 to unsigned 8-bit binary.

  1. Start with the largest place value, 128. Since 196 can include 128, write 1 and subtract: 196 - 128 = 68.

  2. Try 64 next. Since 68 can include 64, write 1 and subtract: 68 - 64 = 4.

  3. Try 32, 16 and 8. None of these fit into 4, so write 0, 0, 0.

  4. Try 4. It fits exactly, so write 1 and subtract: 4 - 4 = 0.

  5. The 2 and 1 columns are not needed, so write 0, 0.

  6. The final 8-bit answer is 1100 0100.

Tip

Quick check for unsigned answers

If your denary number is above 255, it cannot be represented as an unsigned 8-bit binary number.

Signed 8-bit binary: -128 to +127

GCSE Edexcel also expects you to work with signed 8-bit binary numbers. “Signed” means the number can be positive or negative.

The signed representation you need is two’s complement.

Definition

Two's complement

Two’s complement is a way of representing positive and negative integers in binary. In 8-bit two’s complement, the leftmost bit has the place value -128, while the other columns are 64, 32, 16, 8, 4, 2 and 1.

So the two’s-complement place values are:

-128, 64, 32, 16, 8, 4, 2, 1

The leftmost bit is often called the most significant bit or sign bit.

  • If the leftmost bit is 0, the number is positive or zero.
  • If the leftmost bit is 1, the number is negative.
Key Idea

Same bits, different meaning

The bit pattern 1111 1111 means 255 if it is unsigned, but -1 if it is 8-bit two’s complement. You must know which representation the question is using.

Converting two’s-complement binary to denary

Use the signed place values:

-128, 64, 32, 16, 8, 4, 2, 1

Then add the values where the bit is 1. The only difference from unsigned conversion is that the leftmost column is worth -128, not +128.

Example

Converting two's-complement binary to denary

Convert 1111 1011 to denary, assuming 8-bit two’s complement.

  1. Write the signed place values: -128, 64, 32, 16, 8, 4, 2, 1.

  2. Match the 1 bits to their place values: 1111 1011 uses -128, 64, 32, 16, 8, 2 and 1.

  3. Add the values: -128 + 64 + 32 + 16 + 8 + 2 + 1 = -5.

  4. So 1111 1011 represents -5 in 8-bit two’s complement.

Common Mistake

Treating the sign bit as 128

In two’s complement, the leftmost bit is worth -128, not +128. If you add it as +128, you are doing unsigned conversion instead.

Converting positive denary to two’s-complement binary

Positive two’s-complement numbers from 0 to 127 look the same as unsigned binary, but the leftmost bit must be 0.

For example, +37 in 8-bit two’s complement is 0010 0101.

Tip

Positive signed numbers

If the number is positive in 8-bit two’s complement, use the normal unsigned method, but check that the answer starts with 0.

Converting negative denary to two’s-complement binary

For negative numbers, use the signed place-value table. The leftmost bit must be 1, because negative two’s-complement numbers include the -128 column.

A reliable method is:

  1. Put 1 in the -128 column.
  2. Work out how much you need to add to reach the target negative number.
  3. Use the positive columns to make that amount.
Example

Converting negative denary to two's-complement binary

Convert -37 to 8-bit two’s-complement binary.

  1. Start with the -128 column. A negative number needs a 1 there, so the running total is -128.

  2. Work out how much must be added to reach -37: -128 + 91 = -37, so the positive columns must make 91.

  3. Make 91 from the positive place values: 64 + 16 + 8 + 2 + 1 = 91.

  4. Put 1s in the -128, 64, 16, 8, 2 and 1 columns, and 0s elsewhere.

  5. The final 8-bit answer is 1101 1011.

A second method: flip and add 1

You may also see this method for converting a negative denary number:

  1. Write the positive version in 8-bit binary.
  2. Flip every bit: 0 becomes 1, and 1 becomes 0.
  3. Add 1.

For -37:

  • +37 is 0010 0101.
  • Flipping gives 1101 1010.
  • Adding 1 gives 1101 1011.

Both methods give the same answer.

Common Mistake

Range matters

In 8-bit two’s complement, the valid range is -128 to +127. You cannot represent +128 or -129 using only 8 bits in this system.

Spotting whether an answer is sensible

Before you finish, do a quick range and sign check.

For unsigned 8-bit binary:

  • Minimum is 0000 0000, which is 0.
  • Maximum is 1111 1111, which is 255.

For signed 8-bit two’s complement:

  • 0111 1111 is +127.
  • 1000 0000 is -128.
  • 1111 1111 is -1.
Common Mistake

Forgetting leading zeroes

An 8-bit answer must have 8 bits. For example, 13 is not just 1101; as an 8-bit binary number it is 0000 1101.

Exam technique

In the exam

  1. Check whether the question says unsigned or two’s complement before you start converting.

  2. Write the correct place-value row first: unsigned uses 128 on the left, while two’s complement uses -128 on the left.

  3. Keep exactly 8 bits in your final answer and group them into nibbles, such as 0110 1010.

  4. Check the range: unsigned must be 0 to 255; two’s complement must be -128 to +127.

Self review

Check yourself

  • Convert 1010 0110 to denary as an unsigned 8-bit number.
  • Convert 1010 0110 to denary as an 8-bit two’s-complement number.
  • Convert -18 to 8-bit two’s-complement binary.
You've reached the end

Test yourself on this topic, or move on to the next guide.

FlashcardsSelf-test with active recall
Binary addition and binary shiftsUp next

How was this guide?

Converting denary and 8-bit binary Revision Guide

  1. GCSE
  2. /Computer Science
  3. /Converting denary and 8-bit binary