Number Bases and Units of Information
Why computers use binary at all, how to convert between denary, binary and hexadecimal in both directions, and the units of information using AQA's decimal convention.
Why binary
Computers use binary, base 2, because the components they are built from have two reliable states. A transistor is either conducting or it is not. A voltage is either above the threshold or below it. A region of a disc is magnetised one way or the other.
Two states can be told apart even when the signal is noisy. Ten states would need nine thresholds, and a small amount of interference would push a value across one of them. Every extra state makes the electronics more expensive and less reliable, and binary is the point at which reliability is maximised.
Computers use binary because their components have two easily distinguishable states, which makes storing and transmitting data reliable even when the signal degrades.
Base 2, base 10 and base 16
A number base is how many different digits a system uses.
- Denary, base 10, uses the digits 0 to 9. Place values are 1, 10, 100, 1000.
- Binary, base 2, uses 0 and 1. Place values are 1, 2, 4, 8, 16, 32, 64, 128.
- Hexadecimal, base 16, uses 0 to 9 then A to F for ten to fifteen. Place values are 1, 16, 256.
Converting between the bases
Binary to denary
Write the place values above the bits and add up every column holding a 1.
128 64 32 16 8 4 2 1
1 0 1 1 0 1 0 0
128 + 32 + 16 + 4 = 180Denary to binary
Work from the left. Take the largest place value that fits, write a 1, subtract it, and carry on.
180 minus 128 leaves 52, so the 128 column is 1. 64 does not fit into 52, so 0. 52 minus 32 leaves 20, so 1. 20 minus 16 leaves 4, so 1. 8 does not fit, so 0. 4 minus 4 leaves 0, so 1. Then 0 and 0. The answer is 10110100.
Binary to hexadecimal
Split into groups of four bits from the right and convert each group on its own.
10110100 becomes 1011 and 0100. 1011 is 11, which is B. 0100 is 4. So the answer is B4.
Hexadecimal to binary
Reverse it. Each hex digit becomes exactly four bits. 2F becomes 0010 and 1111, so 00101111.
Hexadecimal to denary and back
B4 is 11 times 16, plus 4, which is 180. Going the other way, 180 divided by 16 is 11 remainder 4, so the digits are B and 4.
Denary to hex is denary to binary to hex. Hex to denary is hex to binary to denary. That way you only ever need two conversions rather than six.
Why hexadecimal is used
Sixteen is two to the power of four, so one hexadecimal digit stands for exactly four bits and one byte is always two hex digits. A value written in hex takes a quarter of the characters, which makes memory addresses, colour codes and MAC addresses far easier for people to read, write and compare without mistakes.
Number base converter
Convert between denary, binary and hexadecimal, with every step of the working written out. 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.
- Eight columns, and each one is worth double the one to its right.
- A 1 means take that column's value. A 0 means skip it.
- Add up the columns you took: 64 + 16 + 8 + 2 = 90.
- The leftmost bit is worth more than every other bit added together.
- Split the byte into two nibbles of four bits. Colours keep each nibble with its digit.
- Convert each nibble on its own with 8, 4, 2 and 1: 1010 is 10 and 1111 is 15.
- Write each value as one hex digit, 10 as A and 15 as F, and put them side by side.
- Learn the table: 0 to 9 look the same in hex, then A is 10 up to F which is 15.
Units of information
A bit is a single binary digit, a 0 or a 1. A nibble is 4 bits. A byte is 8 bits.
| Unit | Size |
|---|---|
| kilobyte (kB) | 1000 bytes |
| megabyte (MB) | 1000 kilobytes |
| gigabyte (GB) | 1000 megabytes |
| terabyte (TB) | 1000 gigabytes |
This is a genuine board difference and it changes your answers. Divide by 1000 at every step, and if you use 1024 you will not match the mark scheme.
Calculating a file size
Every file size question follows the same three steps.
- Work out the total number of bits using the right formula.
- Divide by 8 to get bytes.
- Divide by 1000 for each unit you go up.
The formulas themselves come in the images, sound and compression topics, but the conversion at the end is always the same, and it is where most marks are lost.
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.
- 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.
- 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 single binary digit, either 0 or 1.
- Nibble
- Four bits, which is one hexadecimal digit.
- Byte
- Eight bits.
- Binary
- Base 2, using only the digits 0 and 1.
- Denary
- Base 10, the everyday number system using the digits 0 to 9.
- Hexadecimal
- Base 16, using 0 to 9 and then A to F.
- Place value
- The value a digit represents because of its position in a number.
- Kilobyte
- One thousand bytes in the convention AQA uses.
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
The marks here are almost entirely method marks, and the students who lose them are the ones working in their heads.
Write the place values down every time. 128, 64, 32, 16, 8, 4, 2, 1 above the columns. It takes five seconds and it removes almost every conversion error.
Show the subtraction. In denary to binary, writing 180 minus 128 equals 52 earns method credit even if a later column goes wrong.
Check the other way. A conversion takes ten seconds to verify by converting back, and a wrong answer you caught costs nothing.
Say which convention you used. If a file size question is ambiguous, write "using 1 kB as 1000 bytes" beside your working. AQA's mark schemes expect 1000, and stating it protects you either way.
Mistakes that cost marks here
- Using 1024 rather than 1000 when converting units for AQA.
- Forgetting to divide by 8 when converting bits to bytes.
- Reading binary from the wrong end. The leftmost bit has the largest place value.
- Writing hex digits above F. Hexadecimal stops at F, which is fifteen.
- Splitting binary into groups of four from the left rather than from the right, which puts every digit in the wrong column.
AQA is one of the boards that uses 1000 bytes to a kilobyte rather than 1024. That is not a simplification: it matches the international standard, in which 1024 bytes is properly a kibibyte.
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.
- LThe components a computer is built from have two distinguishable states
- LThis makes storing and transmitting data reliable even when the signal degrades
Computers are built from components such as transistors that have two clearly distinguishable states, either conducting or not conducting. Representing data with just two symbols means a value can still be read correctly even when the signal has been weakened or has picked up interference, which makes storage and transmission far more reliable than a system with many states would be.
- LShows a valid method, such as subtracting place values
- LGives the answer 11010110
Starting from the largest place value, 128 fits into 214 leaving 86, so the 128 column is 1. 64 fits into 86 leaving 22, so 1. 32 does not fit, so 0. 16 fits into 22 leaving 6, so 1. 8 does not fit, so 0. 4 fits leaving 2, so 1. 2 fits leaving 0, so 1. Then 0. The answer is 11010110.
- LSplits into two groups of four bits, 0111 and 1010
- LGives the answer 7A
Splitting the eight bits into groups of four from the right gives 0111 and 1010. The group 0111 is 4 plus 2 plus 1, which is 7. The group 1010 is 8 plus 2, which is 10, and 10 is written as A in hexadecimal. So the answer is 7A.
- LOne hexadecimal digit represents exactly four bits
- LSo a value can be written in a quarter of the characters
- LShorter values are easier for people to read and less likely to be mistyped
Sixteen is two to the power of four, so each hexadecimal digit corresponds to exactly four bits and a byte is always written as two hexadecimal digits. A long run of ones and zeros is extremely easy to lose your place in, and a single misread digit gives a completely different value. Written in hexadecimal the same value takes a quarter of the characters, so it is quicker to read aloud, quicker to write down and far easier to compare with another value, which is why memory addresses, colour codes and MAC addresses are all written this way.
- LConverts megabytes to kilobytes by multiplying by 1000
- LConverts kilobytes to bytes by multiplying by 1000
- LMultiplies bytes by 8 to get 48000000 bits
Six megabytes is 6 times 1000, which is 6000 kilobytes. That is 6000 times 1000, which is 6000000 bytes. Each byte is 8 bits, so the file is 6000000 times 8, which is 48000000 bits.