- How positive whole numbers are represented in denary, binary and hexadecimal.
- How to add 8-bit binary numbers, spot overflow, and perform binary shifts.
- How characters, images and sound are stored using binary codes.
- How colour depth, resolution, sample rate, duration and bit depth affect file size and quality.
Computers store data using binary, which means only two symbols: 0 and 1. A single binary digit is called a bit. A group of 8 bits is called a byte.
Bit and byte
A bit is one 0 or 1. A byte is 8 bits. File sizes are often calculated in bits first, then converted to bytes by dividing by 8.
OCR uses decimal storage prefixes:
- 1 kB = 1,000 bytes
- 1 MB = 1,000 kB
- 1 GB = 1,000 MB
- 1 TB = 1,000 GB
- 1 PB = 1,000 TB
Using 1,024 instead of 1,000 is also accepted, but unless a question says otherwise, use the OCR decimal version.
Denary is base 10, the normal number system you use every day.
Binary is base 2, using only 0 and 1.
Hexadecimal is base 16, using digits 0–9 and letters A–F, where A means 10 and F means 15.
For J277 data storage, you need these ranges:
- Denary: 0–255
- Binary: 00000000–11111111
- Hexadecimal: 00–FF
J277 only expects positive whole numbers here. You do not need signed negative binary.
Most and least significant bits
In an 8-bit binary number, the most significant bit is the leftmost bit, with place value 128. The least significant bit is the rightmost bit, with place value 1.
A binary number can be written with fewer than 8 bits, but you can pad it with leading zeros. For example, 11010 is the same value as 00011010.
The diagram below shows the 8-bit place values, the two 4-bit nibbles, and how nibbles link neatly to hexadecimal.

An 8-bit binary number uses these place values:
128, 64, 32, 16, 8, 4, 2, 1
To convert binary to denary, add the place values where the bit is 1.
To convert denary to binary, choose which place values are needed to make the number.
Converting 154 to 8-bit binary
- Start with the largest place value, 128. Since 154 includes 128, the first bit is 1 and 26 is left over.
- 26 does not include 64 or 32, so those bits are 0. It does include 16, leaving 10.
- 10 includes 8, does not include 4, includes 2, and does not include 1. The bits are therefore
10011010.
- Check by converting back: 128 + 16 + 8 + 2 gives 154, so
10011010 is correct.
Hexadecimal is useful because one hex digit represents exactly 4 bits. Those 4 bits are called a nibble.
For example:
0000 is 0
1001 is 9
1010 is A
1111 is F
To convert binary to hexadecimal, split the binary into nibbles from the right. To convert hexadecimal to binary, replace each hex digit with its 4-bit binary version.
Converting 10110101 to hexadecimal and denary
- Split the 8-bit binary number into nibbles:
10110101 becomes 1011 0101.
- Convert each nibble.
1011 is 11 in denary, so it is B in hexadecimal. 0101 is 5.
- The hexadecimal answer is
B5.
- To convert
B5 to denary, use the hex place values: B means 11, so 11 lots of 16 plus 5 gives 181.
Two-digit hexadecimal
For this topic, write hexadecimal as two digits from 00 to FF. For example, denary 9 is 09, not just 9.
Binary addition uses similar rules to denary addition, but base 2:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 1 = 10, so write 0 and carry 1
- 1 + 1 + 1 = 11, so write 1 and carry 1
An overflow error occurs when the result is too large to fit into the number of bits available. With 8 bits, the largest positive value is 255.
Spotting overflow in binary addition
- Add the two 8-bit numbers:
11001010 + 01000111 = 1 00010001. The answer has a ninth bit.
- An 8-bit register can only store
00000000 to 11111111, so the ninth bit cannot fit.
- In denary, the calculation is 202 + 71, which gives 273. Since 273 is greater than 255, overflow has occurred.
Ignoring the ninth bit
If an 8-bit addition produces a ninth bit, do not simply copy the final 8 bits as if everything is fine. You must state that overflow has occurred.
A binary shift moves every bit left or right by a set number of places. Empty spaces are filled with zeros.
For positive whole numbers:
- A left shift by one place multiplies by 2.
- A left shift by two places multiplies by 222^222, so by 4.
- A right shift by one place divides by 2, using the whole-number quotient.
- A right shift by two places divides by 222^222, so by 4.
Carrying out left and right shifts
- Start with
00010110, which is denary 22.
- Shift left by two places:
00010110 becomes 01011000. This matches multiplying by 4, because 22 times 4 gives 88.
- Shift right by one place from the original number:
00010110 becomes 00001011. This matches dividing 22 by 2, giving 11.
Bits can be lost
If bits move beyond the left or right edge during a shift, they are discarded. A left shift can therefore cause overflow if the result no longer fits in 8 bits.
A character is a letter, digit, space, punctuation mark or symbol. To store characters, computers use binary codes.
Character set
A character set is the complete list of characters a computer can represent, together with the binary code assigned to each character.
Character sets are logically ordered. For example, the code for B is one more than the code for A. You do not need to memorise the actual ASCII codes.
ASCII represents a smaller set of characters, mainly English letters, digits and common symbols. In the exam, ASCII binary values will use 8 bits.
Unicode is designed to represent a much wider range of characters, including many languages and symbols. A larger character set needs more possible binary patterns, which can increase storage per character.
The number of possible character codes depends on the number of bits per character:
number of codes=2bits per character\text{number of codes} = 2^{\text{bits per character}}number of codes=2bits per character
Text file size uses:
text size in bits=bits per character×number of characters\text{text size in bits} = \text{bits per character} \times \text{number of characters}text size in bits=bits per character×number of characters
Calculating character codes and text size
- With 8 bits per character, the number of possible codes is 28=2562^8 = 25628=256.
- A text file with 500 characters using 8 bits per character needs 8 times 500 bits, which is 4,000 bits.
- Convert bits to bytes by dividing by 8, so 4,000 bits becomes 500 bytes.
A digital image is stored as a grid of pixels. A pixel is one tiny square of colour in an image. Each pixel has a binary code representing its colour.
Resolution means the number of pixels in the image, usually described using width and height. Colour depth is the number of bits used to store the colour of each pixel.
The diagram below links image storage and sound storage, including the file size formulas you need.

Metadata
Metadata is data about data. Image metadata can store extra information such as width, height, colour depth, date created or camera settings.
Increasing resolution gives more pixels, so the image can show more detail, but the file size increases. Increasing colour depth allows more possible colours, so the image may look more realistic, but the file size also increases.
For images:
image size in bits=colour depth×height×width\text{image size in bits} = \text{colour depth} \times \text{height} \times \text{width}image size in bits=colour depth×height×width
Calculating image file size
- An image is 200 pixels wide and 100 pixels high, so it contains 20,000 pixels.
- If the colour depth is 4 bits per pixel, the image data needs 80,000 bits.
- Divide by 8 to convert to bytes: 80,000 bits is 10,000 bytes, which is 10 kB using OCR’s decimal prefixes.
Sound in the real world is analogue, meaning it varies continuously. A computer must store it as binary, so it measures the sound at regular intervals. Each measurement is called a sample.
Sample rate is the number of samples taken per second, measured in Hertz (Hz). A sample rate of 44,100 Hz means 44,100 samples are taken every second.
Duration is how many seconds of audio the sound file contains.
Bit depth is the number of bits available to store each sample, such as 16-bit audio.
Higher sample rate usually captures the shape of the sound more accurately. Higher bit depth allows each sample to be stored more precisely. Both improve playback quality, but both increase file size.
For sound:
sound size in bits=sample rate×duration×bit depth\text{sound size in bits} = \text{sample rate} \times \text{duration} \times \text{bit depth}sound size in bits=sample rate×duration×bit depth
Calculating sound file size
- A sound clip has a sample rate of 8,000 Hz, a duration of 10 seconds and a bit depth of 8 bits.
- Multiply the three values: 8,000 samples per second for 10 seconds gives 80,000 samples, and each sample uses 8 bits.
- The file size is 640,000 bits. Dividing by 8 gives 80,000 bytes, which is 80 kB using decimal prefixes.
In the exam
- Check the base before converting: denary uses 0–255, binary uses up to 8 bits, and hexadecimal uses 00–FF.
- For file size questions, calculate in bits first, then divide by 8 to get bytes.
- When a question asks about quality and file size, link both: higher resolution, colour depth, sample rate or bit depth usually improves quality but increases file size.
Check yourself
- Why does an 8-bit binary addition overflow if the result is greater than 255?
- How many possible characters can be represented with 8 bits per character?
- What happens to image file size if both resolution and colour depth are increased?