ASCII is a standard for encoding characters (letters, digits, punctuation and control codes). It gives every character its own unique number, stored in binary.
ASCII uses 7 bits per character, so it has 2⁷ = 128 codes (0 to 127).
Codes 0–31 are control codes, such as carriage return and tab: they control devices rather than print a symbol.
Codes are grouped and in sequence: capital letters run A–Z from 65, small letters a–z from 97, and digits 0–9 from 48.
So if you know one code you can work out another: D is 3 after A, so D = 65 + 3 = 68.
A small letter's code is 32 more than its capital (a = 97, A = 65).
The digit character '7' (code 55) is not the number 7: it is a symbol with its own code.
Character
Denary code
7-bit binary
space
32
010 0000
0
48
011 0000
9
57
011 1001
A
65
100 0001
Z
90
101 1010
a
97
110 0001
z
122
111 1010
Worked exampleThe code for 'k' is 107. What is the code for 'h'?
h comes 3 letters before kh, i, j, k
107 − 3 = 104
104 (110 1000 in 7-bit binary).
Exam tipASCII is 7-bit: Pearson doesn't accept 8 (that is extended ASCII). And it is a character encoding, not a programming language or a kind of encryption, which some students wrote.
Character set
The set of characters a computer can represent, each with a unique binary code.
ASCII
A 7-bit character encoding standard with 128 codes (0 to 127); codes 0–31 are control codes.
Control code
A non-printing character that controls a device, such as a new line.
Edexcel 1CP2 · 2.2.1
Beyond ASCII
128 codes are enough for English letters, digits and punctuation, but not for accented letters, other alphabets (Greek, Arabic, Chinese) or emoji.
Other character sets use more bits per character, so they can represent many more characters, including non-English ones.
You only need to know that these alternatives exist (extended ASCII and Unicode are examples). You don't need their details.
Exam tipA limitation of ASCII in one sentence: 7 bits give only 128 codes, so many characters from other languages can't be represented.
Edexcel 1CP2 · 2.2.2
Bitmap images and pixels
A bitmap image is a grid of pixels (picture elements). A pixel is the smallest element of a bitmap, and each pixel's colour is stored as a binary code.
The size of an image is its width × height in pixels: the boat is 6 × 5 pixels (30 pixels).
More pixels means more detail, but more bits to store.
File size in bits = width × height × colour depth, plus metadata. Building these into expressions in KiB or MiB is in the storage units and file sizes topic.
Each pixel's colour is a 2-bit code
Exam tip“Image size” is width × height in pixels. Don't include the colour depth (that gives the file size) and don't forget the unit “pixels”: both lost marks in 2024.
Pixel
Picture element: the smallest element of a bitmap image.
Bitmap
An image stored as a grid of pixels, each with a binary colour code.
Image size
The width × height of an image in pixels.
Edexcel 1CP2 · 2.2.2
Colour depth
Colour depth is the number of bits used to represent the colour of each pixel.
n bits per pixel give 2ⁿ colours: the more bits, the more colours or shades can be shown.
Each extra bit doubles the number of colours.
A greater colour depth means more bits per pixel, so a larger file. Doubling the colour depth doubles the pixel data.
To find the minimum colour depth for a number of colours, find the smallest n where 2ⁿ is at least that number: 12 colours need 4 bits (2³ = 8 is too few).
Colour depth (bits)
Number of colours (2ⁿ)
1
2
2
4
3
8
4
16
8
256
24
16 777 216
Exam tipA 1-bit image can show only 2 colours, because 1 bit has only two states. In 2023 many students answered a question about this as if it were about resolution.
Colour depth
The number of bits used to represent the colour of each pixel.
Edexcel 1CP2 · 2.2.2
Resolution and pixelation
For Pearson, resolution is the number of pixels per inch (ppi). It sets how big the image is when it is displayed or printed.
Printed width in inches = width in pixels ÷ ppi. A 200 × 100 pixel image at 100 ppi is 2 in × 1 in; at 200 ppi it is 1 in × 0.5 in.
Higher resolution = more pixels per inch, so each pixel is smaller and the image looks sharper.
A low-resolution image stretched to fill a bigger space has fewer pixels per inch, so each pixel shows up as a visible block: the image is pixelated.
Same pixels, different pixels per inch
Worked exampleA photo is 900 × 600 pixels. How big is it printed at 300 ppi?
900 ÷ 300 = 3width
600 ÷ 300 = 2height
3 inches by 2 inches.
Exam tipHigher resolution means more pixels per inch, not just “more pixels” or “a higher bit depth”: those answers didn't score in 2022.
Resolution
The number of pixels per inch (ppi), which sets the physical size of an image when it is displayed or printed.
Pixelation
When individual pixels can be seen as blocks, because there are too few pixels per inch.
Edexcel 1CP2 · 2.2.2
Metadata
Metadata is data about the file: information about the properties of the image, stored in the file alongside the pixel data.
Examples: width and height in pixels, colour depth, resolution, date and time taken, camera model, location.
The computer needs some of it (width, height, colour depth) to rebuild the image from the bits.
Metadata adds to the file size, on top of the pixel data.
Metadata
Data about a file, such as an image's width, height, colour depth and the date it was taken; it adds to the file size.
Edexcel 1CP2 · 2.2.2
Turning binary into a bitmap, and back
Pearson reads the bits from the top-left pixel, left to right along each row, then row by row down to the bottom-right pixel.
Binary to image: split the bits into groups of the colour depth (1 bit, 2 bits…), then colour one pixel per group using the key.
Image to binary: write each pixel's code in the same order.
Number of bits for the pixels = width × height × colour depth.
Worked exampleA 4 × 3 image has colour depth 1 (1 = black, 0 = white). Its bits are 1001 0110 1001. Draw it.
Worked exampleUsing the boat's key (00 white, 01 light blue, 10 grey, 11 dark blue), write the binary for row 5: R B B B B R.
R = 10, B = 112 bits per pixel
10 11 11 11 11 10 (12 bits).
Edexcel 1CP2 · 2.2.3
Representing sound
Sound is an analogue signal: it varies continuously. A computer stores it as digital data: a series of discrete values. Turning one into the other is called sampling.
CD quality: a sample rate of 44.1 kHz (44 100 samples a second), a bit depth of 16, and stereo (2 channels).
Higher sample rate (shorter sample interval): more samples a second, so the changes in the wave are captured more closely.
Greater bit depth: more possible values for each sample, so each amplitude is stored more precisely.
Both make the recording more accurate but the file larger. File size in bits = sample rate × bit depth × duration in seconds × channels (expressions are in the storage units topic).
A digital recording is never a perfect copy: it only has the amplitude at the sample points, and each value is rounded to the nearest level the bit depth allows.
Term
Meaning
Amplitude
The height of the sound wave: it sets the loudness. Higher amplitude, louder sound
Sample
A measure of the amplitude at one point in time
Sample rate
The number of samples taken per second, in hertz (Hz)
Sample interval
The time between one sample and the next
Bit depth
The number of bits used to store each sample
Channels
Separate recordings played together: mono is 1, stereo is 2
Samples taken at equal intervals, each stored with 3 bits
Exam tipSample interval is the time between samples. Sample rate is the number of samples per second. In 2024 many students mixed them up.
Analogue
Continuously varying.
Digital
Made of discrete (separate) values.
Sample rate
The number of samples taken per second, measured in hertz.
Sample interval
The time between samples.
Bit depth
The number of bits used to represent each sound sample.
Edexcel 1CP2 · 2.2.4
The limits of a fixed number of bits
The number of bits available sets how many different values can be represented: n bits give 2ⁿ. More bits give a wider range, but take more storage.
Data
Limited by
Too few bits means…
Characters
Bits per character
Not enough codes for every character (7-bit ASCII: 128)
Images
Colour depth
Too few colours: shades are lost or merged
Sound
Bit depth (and sample rate)
Amplitudes rounded to fewer levels, so less accurate sound
Numbers
Bits per number
Values out of range, or overflow
Worked exampleA lift display shows the 10 digits and 12 other symbols. How many bits are needed per character?