Units of Data
Bits, nibbles and bytes through to petabytes, why computers use binary at all, and how to answer file size calculation questions without losing marks on the units.
Why binary
Computers use binary, base 2, because the components they are built from have exactly two reliable states.
A transistor is either conducting or not. A capacitor is charged or not. A region of a disk is magnetised one way or the other. Two states can be distinguished quickly and reliably even when voltages fluctuate slightly.
Ten distinguishable voltage levels for denary would be far harder to build, far more error prone, and far more expensive. So everything, numbers, text, images, sound, instructions, is stored as patterns of 1s and 0s.
Computers use binary because their electronic components have two states, on and off, which can represent 1 and 0 reliably.
The units
| Unit | Symbol | Size |
|---|---|---|
| Bit | b | A single 1 or 0, the smallest unit of data |
| Nibble | 4 bits | |
| Byte | B | 8 bits |
| Kilobyte | KB | 1000 bytes |
| Megabyte | MB | 1000 kilobytes |
| Gigabyte | GB | 1000 megabytes |
| Terabyte | TB | 1000 gigabytes |
| Petabyte | PB | 1000 terabytes |
OCR J277 uses 1000, not 1024. Historically 1 KB meant 210 = 1024 bytes, and some software still reports sizes that way, but for this specification use powers of 1000. If a question uses 1024 it will say so.
Converting between units
To go up a unit, divide by 1000. To go down a unit, multiply by 1000.
- 6000 bytes = 6 KB
- 3.5 MB = 3500 KB = 3,500,000 bytes
- 12,000,000,000 bytes = 12 GB
Bits to bytes: divide by 8. Bytes to bits: multiply by 8.
- 2 KB = 2000 bytes = 16,000 bits
- A bit is one binary digit: a single 0 or a single 1.
- Eight bits make a byte, which is enough for one character.
- A thousand bytes make a kilobyte. A page of plain text.
- A thousand kilobytes make a megabyte. A photograph, or a minute of music.
- A thousand megabytes make a gigabyte, and a thousand of those a terabyte.
Calculating file sizes
Three formulas cover almost every calculation question at GCSE.
Text
file size (bits) = number of characters x bits per character
A 500 character message in ASCII, which uses 7 bits per character:
500 x 7 = 3500 bits = 437.5 bytes
Images
file size (bits) = colour depth x image height in pixels x image width in pixels
A 400 by 300 image with a colour depth of 8 bits:
8 x 400 x 300 = 960,000 bits = 120,000 bytes = 120 KB
Sound
file size (bits) = sample rate x duration in seconds x bit depth
A 30 second clip at 44,100 Hz with a bit depth of 16:
44100 x 30 x 16 = 21,168,000 bits = 2,646,000 bytes = 2.646 MB
Read the question. If it asks for the answer in kilobytes and you leave it in bits, you lose the mark even though your arithmetic was perfect. Write the unit after every line of working.
A worked full mark answer
An image is 1000 pixels wide, 800 pixels high, with a colour depth of 24 bits. Calculate the file size in megabytes.
24 x 1000 x 800 = 19,200,000 bits 19,200,000 / 8 = 2,400,000 bytes 2,400,000 / 1000 = 2400 KB 2400 / 1000 = 2.4 MB
Every line shows a unit. Even if the final division went wrong, the working earns method marks.
File size calculator
Work out the size of an image, a sound file or a block of text, one conversion at a time. This tool needs JavaScript, so turn it on to use it. Everything you need to answer the exam question is explained in the text above.
- Image: width × height × colour depth. Every pixel costs the colour depth in bits.
- Sound: sample rate × bit depth × seconds, and × 2 for stereo.
- Text: number of characters × bits per character. ASCII uses 8.
- Divide by 8 to turn bits into bytes, then by 1,000 for each step up.
Key terms you must be able to define
- Bit
- A binary digit, either 1 or 0. The smallest unit of data a computer can store.
- Nibble
- Four bits, half a byte.
- Byte
- Eight bits. The standard unit for measuring file sizes.
- Kilobyte
- 1000 bytes in the OCR specification.
- Colour depth
- The number of bits used to store the colour of each pixel in an image.
- Sample rate
- The number of audio samples recorded each second, measured in hertz.
- Bit depth
- The number of bits used to store each individual audio sample.
Flashcards
Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.
Reach the top grade on this topic
This topic is pure technique, and technique is the easiest place to guarantee marks.
Always show working line by line, with units. Examiners award method marks. A single number with no working scores nothing if it is wrong, while correct working with an arithmetic slip at the end usually still scores most of the marks.
Convert at the end, not in the middle. Do the multiplication in bits, then convert down step by step: bits to bytes, bytes to KB, KB to MB. Converting halfway through is where errors creep in.
Watch the wording. "How many bits" and "how many bytes" differ by a factor of 8. "Colour depth of 3 bits" means 23 = 8 possible colours, not 3 colours.
- Learn the three formulas by heart: text, image, sound
- Practise converting bits to megabytes in four clean steps
- Always finish with the unit the question asked for
Mistakes that cost marks here
- Using 1024 instead of 1000. OCR J277 uses 1000.
- Forgetting to divide by 8 when the answer must be in bytes rather than bits.
- Confusing colour depth with number of colours. A colour depth of n bits gives 2 to the power n colours.
- Giving an answer with no unit, or with the wrong unit.
- Doing all the conversions in one step in your head and getting the power of ten wrong.
A nibble is half a byte, and yes, it is genuinely spelled that way in textbooks because it is half a byte. Computing has a long history of engineers naming things at the end of a very long day.
Knowledge check
Exam-style questions
Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.
- LElectronic components have two states, such as on and off or high and low voltage
- LThese two states directly represent 1 and 0, and are reliable to distinguish
Data is stored in binary because the electronic components inside a computer, such as transistors, have two reliable states: they are either conducting or not conducting, which corresponds to a high or low voltage. These two states map directly onto the digits 1 and 0, and because there are only two of them they can be distinguished reliably even if the voltage varies slightly, which would not be true if ten separate levels had to be recognised for denary.
- LMultiplies colour depth by width by height: 16 x 800 x 600
- LObtains 7,680,000 bits
- LDivides by 8 to obtain 960,000 bytes
- LDivides by 1000 twice to obtain 0.96 MB
File size in bits is colour depth multiplied by width multiplied by height, so 16 x 800 x 600 = 7,680,000 bits. Dividing by 8 converts this to 960,000 bytes. Dividing by 1000 gives 960 kilobytes, and dividing by 1000 again gives a final file size of 0.96 megabytes.
- LConverts 4 minutes to 240 seconds
- LMultiplies sample rate by duration by bit depth
- LObtains 169,344,000 bits
- LConverts to approximately 21.17 MB
First convert the duration: 4 minutes is 4 x 60 = 240 seconds. File size in bits is sample rate x duration x bit depth, so 44,100 x 240 x 16 = 169,344,000 bits. Dividing by 8 gives 21,168,000 bytes, dividing by 1000 gives 21,168 kilobytes, and dividing by 1000 again gives a file size of approximately 21.17 megabytes.
- LA nibble is 4 bits
- LA byte is 8 bits
A nibble contains 4 bits and a byte contains 8 bits, so a nibble is exactly half a byte.
- LCalculates bits per image as 24 x 2000 x 1500
- LObtains 72,000,000 bits per image
- LConverts to 9,000,000 bytes or 9 MB per image
- LMultiplies by 3000 photographs
- LObtains 27,000 MB which is 27 GB
For one photograph the file size in bits is 24 x 2000 x 1500 = 72,000,000 bits. Dividing by 8 gives 9,000,000 bytes, which is 9000 kilobytes or 9 megabytes per photograph. Multiplying by 3000 photographs gives 27,000 megabytes in total, and dividing by 1000 converts this to 27 gigabytes of storage required.