Worth about 18 of the 75 marks on a typical Paper 1. Almost every paper opens with this topic.

1. Why computers use binary

Everything a computer stores or processes, whether numbers, text, photos, music or video, is represented as binary: patterns of only two digits, 0 and 1. A single binary digit is called a bit. Data must be converted to binary before a computer can process it.

Numbers42Text“A”Imagesa pixelSoundone sampleconvert tobinaryProcessor and memorylogic gates and transistorsregisters hold a fixednumber of bits1 = on 0 = off
All data must be converted to binary before it can be processed.

Computers use binary because their circuits are built from switches (transistors) with only two states, on and off. Data is processed by logic gates and stored in registers, which hold a fixed number of bits.

2. Denary, binary and hexadecimal

Hexadecimal and denary are just easier ways for people to read the same values the computer stores in binary.

SystemBaseDigits usedWho uses it
Denary100–9People, everyday counting
Binary20, 1The computer, internally
Hexadecimal160–9, A–F (A = 10 … F = 15)Programmers, as a short form of binary

3. Converting binary and denary

Each binary column is worth double the one to its right.

1286432168421
01101001

0110 1001 = 64 + 32 + 8 + 1 = 105. The largest 8-bit value is 1111 1111 = 255; 16 bits reach 65 535, the longest binary number you will be asked to convert.

Denary to binary: start at the largest place value. If it fits, write 1 and subtract; if not, write 0. Move right until you reach 1.

Try it: flip the bits

4. Converting hexadecimal

One hex digit stands for exactly four bits (a nibble), so 8 bits = 2 hex digits.

  1. Binary → hex: split into groups of 4 from the right, then convert each group. 1011 0110 → B 6 → B6.
  2. Hex → binary: write each digit as 4 bits, keeping leading zeros. 3F → 0011 1111.
  3. Hex → denary: first digit × 16, plus second digit. 3F → 3 × 16 + 15 = 63.

5. Uses of hexadecimal

Hex appears in HTML colour codes (#FF8800), MAC addresses, IPv6 addresses, error codes and memory dumps.

It is used because it is shorter and easier for people to read than binary, so fewer mistakes are made. It does not save storage: the computer still stores binary.

6. Binary addition and overflow

SumResultCarry
0 + 000
0 + 110
1 + 101
1 + 1 + 111

Add column by column from the right and always show the carries.

Overflow happens when the result needs more bits than the register holds. Two 8-bit numbers adding to more than 255 leave a 9th bit that cannot be stored, so the stored answer is wrong.

7. Logical binary shifts

  • Left shift by n: every bit moves n places left; 0s fill the gaps on the right. Each place multiplies by 2.
  • Right shift by n: bits move right; 0s fill on the left. Each place divides by 2 (whole-number division).
  • Bits pushed off the end (the most or least significant bits) are lost, so a shift can give a wrong result.

Example: 0001 0110 (22) shifted left 2 → 0101 1000 (88).

8. Two’s complement

In 8-bit two’s complement the leftmost bit is worth −128, so the range is −128 to +127. A leading 1 means the number is negative.

−1286432168421
11101010

To write −22: write +22 (0001 0110), flip every bit (1110 1001), then add 1 → 1110 1010. Check: −128 + 64 + 32 + 8 + 2 = −22.

9. Text: ASCII and Unicode

Character setBits per characterCharactersGood for
ASCII7 (extended: 8)128 (256)English text
UnicodeUp to 32Over a millionEvery language and emojis

Each character has a binary code from a character set. Unicode covers far more characters, but needs more bits per character, so text files are bigger.

10. Sound

A microphone produces an analogue wave. The computer measures (samples) its height at regular intervals and stores each sample in binary.

  • Sample rate (sampling rate): samples taken per second, in hertz. Higher rate = more accurate recording, bigger file.
  • Sample resolution (bit depth): bits used to store each sample. More bits = more accurate amplitude, bigger file.

Sound file size (bits) = sample rate × sample resolution × length in seconds.

11. Images

A bitmap image is a grid of pixels, and each pixel’s colour is stored as a binary number.

  • Resolution: the number of pixels (width × height). More pixels = more detail, bigger file.
  • Colour depth: bits per pixel. With n bits a pixel can be one of 2n colours (8 bits = 256 colours).

Image file size (bits) = width × height × colour depth.

12. Storage units and file size

The syllabus uses powers of 2 (1024), not 1000.

UnitSize
Nibble4 bits
Byte8 bits
Kibibyte (KiB)1024 bytes
Mebibyte (MiB)1024 KiB
Gibibyte (GiB)1024 MiB
Tebibyte (TiB)1024 GiB
Pebibyte (PiB)1024 TiB
Exbibyte (EiB)1024 PiB

Bits ÷ 8 = bytes, then ÷ 1024 for each step up. Example: a 1024 × 512 image with a colour depth of 8 bits = 4 194 304 bits = 524 288 bytes = 512 KiB.

13. Compression

Compression makes files smaller, so they need less storage, transfer faster and use less bandwidth.

TypeHow it worksResultUse it for
LossyPermanently removes data: lower resolution or colour depth, lower sample rate or resolution, sounds people cannot hearMuch smaller file, some quality lost, original cannot be restoredPhotos, music, video
LosslessNo data lost, e.g. run-length encoding (RLE): AAAAABBB → 5A 3BSmaller file, original rebuilt exactlyText, program files

14. Examiner tips

  1. Binary addition done in denary. Add in binary and show every carry, or you lose the working marks.
  2. Shifting the wrong way, or filling with 1s. Read “left” or “right” carefully, and fill with 0s.
  3. Two’s complement read as normal binary. A leading 1 means negative.
  4. Hex converted as one big number. For hex 14, convert the 1 and the 4 separately (0001 0100).
  5. Missing leading zeros. An 8-bit answer needs all 8 bits.
  6. Saying hex uses less memory. It doesn’t; it is just easier for people to read.
  7. Mixing up sample rate and sample resolution. Rate = per second; resolution = bits per sample.
  8. Image ideas in sound questions. Sample resolution has nothing to do with pixels.
  9. Naming a file type as a compression method. “Zip” or “JPEG” is not a method.
  10. Ignoring the context. Mention the scenario in your answer.

15. Practice questions

Practice: answer and check instantly

Q1 A sensor stores the denary value 77.

Show answer

0100 1101: 64 + 8 + 4 + 1 = 77, with a leading 0 to make 8 bits.

Show answer

0100 = 4 and 1101 = D, so 4D.

Show answer

A = 10, so 10 × 16 + 7 = 167.

Q2 Two 8-bit registers are added.

Show answer

1100 0001. In the exam, show every carry to get the working mark.

Show answer

0001 1011. The true answer is 283, which is more than 255, so the 9th bit is lost: this is an overflow error [2 more marks for explaining that].

Q3 The register holds 0011 0101.

Show answer

1101 0100. Every bit moves 2 places left and 0s fill on the right (53 × 4 = 212).

Show answer

0000 0110 = 6. The three right-most bits are lost, so 53 ÷ 8 gives 6, not 6.625.

More practice: Q4–Q8 (19 marks)

Five more exam-style questions on two’s complement, sound and image file sizes, Unicode and compression, each with a full mark guide, are included in Revision Hub Plus.

16. Topic test: predict your grade

Topic test: predict your grade

15 questions, about 10 minutes. Answer them all, then press Mark my test.

1. What is 1001 0110 in denary?
2. What is the hexadecimal value of 1110 0011?
3. Which number system do HTML colour codes use?
4. What is the largest denary value 8 bits can store?
5. A logical left shift of one place has what effect on a positive number?
6. In 8-bit two’s complement, what is the leftmost bit worth?
7. What does sample resolution mean?
8. How many colours can a pixel have with a colour depth of 4 bits?
9. How many bytes are in 1 KiB?
10. Which compression method is lossless?
11. When does overflow happen in 8-bit binary addition?
12. What is 0101 1000 after a logical right shift of two places?
13. What is 1000 0001 in 8-bit two’s complement?
14. An image is 100 × 100 pixels with a colour depth of 8 bits. What is its size?
15. Why is hexadecimal used instead of binary?

Frequently asked questions

How do you convert binary to denary?

Write the place values 128, 64, 32, 16, 8, 4, 2, 1 above the 8 bits and add the values wherever there is a 1. For example, 01101001 is 64 + 32 + 8 + 1 = 105.

Why is hexadecimal used in computing?

Hexadecimal is shorter and easier for humans to read than binary, so it is used for things like colour codes, MAC addresses and error codes. Each hex digit represents exactly 4 bits.

What is the difference between lossy and lossless compression?

Lossy compression permanently removes some data to make a much smaller file, as in JPEG and MP3. Lossless compression reduces file size without losing any data, so the original can be rebuilt exactly, as in run-length encoding.

How do you calculate the file size of an image?

Multiply the width in pixels by the height in pixels by the colour depth in bits. Divide by 8 to get bytes.