You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Understanding number systems is the foundation of data representation in Computer Science. Computers operate using binary (base-2), while humans typically use denary (base-10, also called decimal). This lesson explains both systems and how to convert between them.
The denary system is the number system you use every day. It is a base-10 system, meaning it uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Each column in a denary number represents a power of 10:
| Thousands (10³) | Hundreds (10²) | Tens (10¹) | Units (10⁰) |
|---|---|---|---|
| 1000 | 100 | 10 | 1 |
For example, the number 3742 means:
This is called positional notation — the value of a digit depends on its position in the number.
The binary system is a base-2 system. It uses only two digits: 0 and 1. Each digit in a binary number is called a bit (short for binary digit).
Each column in a binary number represents a power of 2:
| 128 (2⁷) | 64 (2⁶) | 32 (2⁵) | 16 (2⁴) | 8 (2³) | 4 (2²) | 2 (2¹) | 1 (2⁰) |
|---|---|---|---|---|---|---|---|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Computers are built from billions of tiny electronic switches called transistors. Each transistor can be in one of two states:
Because there are only two states, binary is the natural number system for computers. Everything a computer processes — numbers, text, images, sound — is ultimately stored as sequences of 0s and 1s.
flowchart LR
A[Denary number] -->|subtract place values| B[Binary digits]
A -->|divide by 2 repeatedly| B
B -->|sum place values of 1-bits| A
B --> C[8-bit byte]
C --> D[Range 0 to 255]
To convert a binary number to denary, write out the place values and add up the columns that contain a 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Add the place values where the bit is 1:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
To convert a denary number to binary, use the successive division by 2 method or the place value method.
200 in binary = 11001000
| Division | Quotient | Remainder |
|---|---|---|
| 53 ÷ 2 | 26 | 1 |
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Reading remainders bottom to top: 53 in binary = 110101
(As an 8-bit binary number with leading zeros: 00110101)
Exam Tip: Always double-check your binary-to-denary conversions by adding up the place values. A common mistake is misaligning the place values. An 8-bit number has a maximum unsigned value of 255 (11111111 in binary = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1).
Using the place value method, write the column headings and ask whether each value fits into the remainder.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
173 in denary = 10101101 in binary.
To verify, convert back: 128 + 32 + 8 + 4 + 1 = 173. The conversion is correct.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Adding the place values containing a 1: 128 + 64 + 32 + 16 = 240.
This is a useful pattern to remember: the upper nibble (the leftmost four bits) being all 1s and the lower nibble being all 0s gives 240.
| 8 | 4 | 2 | 1 |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
7 = 4 + 2 + 1, so the nibble is 0111. Nibbles are useful when working with hexadecimal because each nibble corresponds to a single hex digit.
The smallest unsigned value in 8 bits is 00000000 (0). The largest is 11111111, which equals 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. This is why an unsigned byte ranges from 0 to 255.
When you do not have time to write the full table, use these shortcuts.
The denary number 65 is 64 + 1, so it must be 01000001 in binary. Notice the 1s are in the 64 and 1 columns. This pattern occurs frequently in ASCII (65 is the code for the letter A).
Every positional number system relies on the same idea: each column represents a successively larger power of the base. In denary, the columns are powers of ten (1, 10, 100, 1000, ...). In binary, they are powers of two (1, 2, 4, 8, 16, 32, 64, 128, ...). In hexadecimal, they are powers of sixteen (1, 16, 256, 4096, ...).
This means that all conversion methods reduce to adding place values in the target base, or dividing by the base to find each digit in turn. Once you understand the principle, you can convert between any pair of bases.
Although the GCSE specification focuses on whole numbers, it is helpful to understand that the same principle extends to fractions. In denary, 0.5 means 5 tenths. In binary, the column to the right of the radix point is 1/2, then 1/4, then 1/8, and so on. The binary number 0.101 therefore equals 1/2 + 1/8 = 0.625 in denary. You will not be examined on this, but it explains why floating-point numbers in computers behave the way they do.
Common mistake: Writing place values left-to-right starting at 1. The place values must be written with the largest on the left (128) and the smallest on the right (1). Reversing them will give a completely wrong answer.
Common mistake: Forgetting that 2^0 = 1, not 2. The rightmost bit always has place value 1.
Common mistake: Confusing the bit value (always 0 or 1) with the place value (1, 2, 4, 8, ...). The bit value tells you whether to include the place value in the sum.
Exam Tip: Always pad your binary answers to the number of bits requested. If the question asks for an 8-bit answer and your conversion gives 110101, write 00110101 with leading zeros. Marks have been lost for missing leading zeros.
Exam-style question: Convert the denary number 156 into an 8-bit binary number. Show your working. (3 marks)
Grades 3-4 answer: "I worked out 156 in binary by trying each column. 128 fits, leaving 28. 64 does not fit, 32 does not fit. 16 fits, leaving 12. 8 fits, leaving 4. 4 fits, leaving 0. So the answer is 10011100." This answer reaches the correct binary value but the reasoning is informal and does not use precise terminology.
Grades 5-6 answer: "Using the place value method, I subtract powers of two starting from the most significant bit (MSB). 156 - 128 = 28 (MSB column = 1). 28 < 64 (column = 0). 28 < 32 (column = 0). 28 - 16 = 12 (column = 1). 12 - 8 = 4 (column = 1). 4 - 4 = 0 (column = 1). Remaining 2 and 1 columns = 0. The 8-bit binary representation is 10011100." This answer uses correct terminology and shows the place value subtraction.
Grades 7-9 answer: "Working in base-2 with eight column place values 2^7 to 2^0, I express 156 as a sum of distinct powers of two: 156 = 128 + 16 + 8 + 4 = 2^7 + 2^4 + 2^3 + 2^2. The corresponding 8-bit binary value is therefore 10011100, with the MSB set in the 128 column and zero bits in the 64, 32, 2, and 1 columns. Verification by reverse conversion: 128 + 16 + 8 + 4 = 156." This answer uses precise mathematical notation, references the MSB explicitly, and includes verification.
AQA alignment: This content is aligned with AQA GCSE Computer Science (8525) specification — specifically section 3.5 Fundamentals of data representation (3.5.1 Number bases, 3.5.2 Converting between number bases, 3.5.3 Units of information, 3.5.4 Binary arithmetic, 3.5.5 Character encoding, 3.5.6 Representing images, 3.5.7 Representing sound, 3.5.8 Data compression). Assessed on Paper 2.