L
LLLOS.ai
Learn
L

Ask Your Tutor · Computer Science

What is the largest and smallest number you can store in 8 bits using two's complement?

General knowledge Asked by Anonymous from London, United Kingdom 23 Oct 2026, 11:15 PM IST Updated

In one line

The largest number in 8-bit two's complement is 127, and the smallest is -128.

The rule

In an n-bit two's complement system, the smallest number is −2ⁿ⁻¹ and the largest is 2ⁿ⁻¹ − 1.

For 8 bits: Smallest: −2⁷ = −128 Largest: 2⁷ − 1 = 127

The formula
Range = −2ⁿ⁻¹ to 2ⁿ⁻¹−1
nnumber of bits

Let's understand it simply

Imagine you have 8 boxes. Each box can hold a 0 or a 1. This is called a bit. In two's complement, we use these bits to show both positive and negative numbers. The first box (on the left) is special. It tells us if the number is positive (0) or negative (1). If it is 0, the number is positive. If it is 1, the number is negative. This way, we can show numbers below zero too!

8-bit Two's Complement: Range
SmallestLargest
Binary1000000001111111
Decimal-128+127

How it works

  1. Write 8 bits: the leftmost bit is the sign bit.
  2. If the sign bit is 0, the number is positive (0 to 127).
  3. If the sign bit is 1, the number is negative (−1 to −128).
  4. The largest positive number: sign bit 0, all other bits 1 (01111111).
  5. The smallest negative number: sign bit 1, all other bits 0 (10000000).

The story behind it

Two's complement was made to make adding and subtracting negative numbers easy for computers. Before this, computers had to use tricky methods to handle negative numbers. Two's complement made the circuits simpler and faster. It is now used in almost every computer and phone.

Where you see it in real life

  • Mobile phones: Storing numbers like temperature or speed, which can be negative.
  • Calculators: Doing subtraction, like 5 − 10 = −5.
  • Game scores: Showing scores that can go below zero.
  • Banking apps: Recording a negative balance.

Why it matters

  • It helps computers do math with negative numbers easily.
  • It saves memory and makes calculations faster.
  • It is the standard way most computers store signed numbers.
  • Understanding it is key for programming, electronics, and computer science exams.

Worked example

Largest (8 bits):
Step 1: 2⁷ − 1 = 128 − 1
Step 2: Answer = 127

Smallest (8 bits):
Step 1: −2⁷ = −128
Step 2: Answer = −128

Common mistakes

  • Thinking the largest is 255 (that is for unsigned numbers, not two's complement).
  • Forgetting that the smallest number is negative, not zero.
  • Mixing up the sign bit's position (it is always the leftmost bit).

Remember it

"Eight bits: minus 128 to plus 127."

Check yourself

What is the largest number you can store in 8 bits using two's complement?

127, because 2⁷−1 = 127.

Why is the smallest number −128 and not −127?

Because the range is not balanced; there is one more negative number.

What is the binary for −128 in 8-bit two's complement?

10000000, with the leftmost bit as 1.

If all 8 bits are 1 (11111111), what number is this in two's complement?

−1, because all bits 1 means −1 in two's complement.

Quick recap

  • 8 bits in two's complement can store numbers from -128 to +127.
  • The leftmost bit shows if the number is positive or negative.
  • Largest: 01111111 (127), Smallest: 10000000 (−128).
  • Two's complement is used for signed numbers in computers.
  • Unsigned 8 bits go from 0 to 255, but two's complement is −128 to 127.
Written by the LLOS.ai tutor. Asked by Anonymous from London, United Kingdom on 23 Oct 2026, 11:15 PM IST