Skip to main content
EnglandComputer ScienceSyllabus dot point

How are signed integers represented in two's complement, and how do you convert between denary and 8-bit binary?

Understand how computers represent and manipulate unsigned integers and two's complement signed integers, and convert between denary and 8-bit binary numbers (0 to 255, and -128 to +127).

A focused answer to Edexcel GCSE Computer Science 2.1.2 and 2.1.3, covering unsigned and two's complement signed integers and converting between denary and 8-bit binary (0 to 255 and -128 to +127).

Generated by Claude Opus 4.89 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Unsigned integers and conversion
  3. Two's complement signed integers
  4. Finding a two's complement representation
  5. Ranges to remember
  6. Try this

What this dot point is asking

Edexcel wants you to represent whole numbers in binary both as unsigned integers (0 and up) and as two's complement signed integers (which can be negative), and to convert fluently between denary and 8-bit binary, covering the unsigned range 0 to 255 and the signed range -128 to +127.

Unsigned integers and conversion

Binary to denary is direct addition: 01100100=64+32+4=10001100100 = 64 + 32 + 4 = 100. Denary to binary is repeated subtraction: for 100, 64 fits (leaving 36), 32 fits (leaving 4), 4 fits (leaving 0), giving 0110010001100100. Always pad the answer to the requested number of bits (8 bits here), and cross-check by adding the place values back.

Two's complement signed integers

The clever part is that ordinary binary addition then works for negative numbers with no special cases, which is why processors use two's complement. The most significant bit doubles as a sign bit: 0 means positive (or zero), 1 means negative. To read a negative two's complement value, add the place values as usual but treat the leftmost as -128: 11011000=βˆ’128+64+16+8=βˆ’4011011000 = -128 + 64 + 16 + 8 = -40.

Finding a two's complement representation

Ranges to remember

These ranges are worth memorising because questions often ask whether a value "fits". For example, +200 cannot be stored as an 8-bit two's complement number, because the maximum is +127; it would need more bits or an unsigned representation.

Try this

Q1. Convert the 8-bit two's complement number 1111111111111111 to denary. [1 mark]

  • Cue. -1, because βˆ’128+64+32+16+8+4+2+1=βˆ’1-128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = -1.

Q2. State the range of values that 8-bit two's complement can represent. [1 mark]

  • Cue. -128 to +127.

Exam-style practice questions

Practice questions written in the style of Pearson Edexcel exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Edexcel 20233 marksConvert the denary number 75 into an 8-bit unsigned binary number. Show your working.
Show worked answer β†’

Use the 8-bit place values 128, 64, 32, 16, 8, 4, 2, 1 and subtract the largest that fits, working left to right.

75 is less than 128 (place value 0). 64 fits, 75βˆ’64=1175 - 64 = 11 (bit 1). 32 does not fit (0). 16 does not fit (0). 8 fits, 11βˆ’8=311 - 8 = 3 (bit 1). 4 does not fit (0). 2 fits, 3βˆ’2=13 - 2 = 1 (bit 1). 1 fits, 1βˆ’1=01 - 1 = 0 (bit 1).

So 75=0100101175 = 01001011. Checking: 64+8+2+1=7564 + 8 + 2 + 1 = 75.

Markers reward the correct place-value method, an 8-bit answer, and a denary cross-check. The result must be padded to 8 bits.

Edexcel 20223 marksUsing 8-bit two's complement, give the binary representation of -40. Show your method.
Show worked answer β†’

Convert +40 to binary, then apply the two's complement method (invert all bits, then add 1).

+40=00101000+40 = 00101000. Invert: 1101011111010111. Add 1: 11010111+1=1101100011010111 + 1 = 11011000.

So βˆ’40=11011000-40 = 11011000 in 8-bit two's complement. Check: the leftmost bit is 1 (negative), and the value is βˆ’128+64+16+8=βˆ’40-128 + 64 + 16 + 8 = -40.

Markers reward converting +40 correctly, inverting all 8 bits, adding 1, and a valid 8-bit answer (with the sign bit set). Stating the most significant bit has place value -128 supports the check.

Related dot points

Sources & how we know this