8-Bit Two’s Complement Calculator
Toggle 8-bit binary registers to see instant signed denary values. Explore both the place-value method (MSB = -128) and the invert-and-add-1 method tested on GCSE Computer Science exam papers.
How Exam Boards Mark Two’s Complement
Method 1: Place-Value Expansion (Examiner Recommended)
In two’s complement, the Most Significant Bit (MSB, bit 7) carries a weight of -128, while all remaining bits carry their normal positive weights (64, 32, 16, 8, 4, 2, 1).
Method 2: Invert and Add 1 (For Converting Negative Numbers to Binary)
To convert a negative number like -42 into 8-bit two’s complement:
- Step 1:Write positive magnitude (+42) in 8-bit binary:
00101010 - Step 2:Invert all bits (0 becomes 1, 1 becomes 0):
11010101 - Step 3:Add 1 to the inverted result:
11010110
How Two’s Complement Works in GCSE Computer Science
Computers only have circuits for addition; they do not have separate subtraction hardware. Two’s complement allows a CPU to subtract numbers by adding negative binary values using standard adder circuits.
The 8-Bit Range: -128 to +127
With 8 bits, an unsigned binary number represents 0 to 255. In two’s complement, the total number of patterns is still 256, but they are split into:
- • 128 negative numbers: -128 to -1
- • Zero: 0 (represented as
00000000) - • 127 positive numbers: +1 to +127
Exam trap: +128 cannot be stored in an 8-bit two’s complement byte. Trying to store it causes an overflow!
The Sign Bit (MSB)
Bit 7 (the left-most bit, or Most Significant Bit) is the sign bit:
- • If bit 7 is 0, the number is positive.
- • If bit 7 is 1, the number is negative (carrying a value of -128).
Examiners frequently award 1 mark simply for stating that bit 7 is the sign bit or has a value of -128.
Exam Formula Tips
1. Fast conversions in your head: Look at the rightmost `1` in the binary number. Keep that `1` and any trailing zeros unchanged, then invert every bit to the left of it. This gives the two’s complement in one step without carrying!
2. Adding a negative number: To compute `10 - 4`, compute `10 + (-4)`. Add their 8-bit binary forms using standard binary addition rules. Any carry out of the 8th bit into the 9th bit is discarded in signed arithmetic.
3. Exam board differences: Sign and magnitude and one’s complement are out of scope for GCSE. Note that while OCR J277 requires two’s complement, AQA 8525 focuses entirely on unsigned binary (0 to 255).
