Conversion of Number Bases – JSS2 Computer Studies Lesson Note (First Term)
Download this term · ₦1,000Lesson note at a glance
- Subject
- Computer Studies
- Class
- JSS2
- Term
- First Term
- Topic
- Conversion of Number Bases
- Order
- Topic 9 of 9 this term
- Reading time
- 5 min
Number base conversion is the process of changing a number from one base to another.
- From decimal: divide repeatedly by the new base and read the remainders upwards.
- To decimal: multiply each digit by its positional weight (a power of the base) and add the results.
Behavioural objectives
By the end of the lesson, students should be able to:
- convert decimal numbers to binary, octal and hexadecimal;
- convert binary, octal and hexadecimal numbers, including fractions, to decimal;
- use positional weights to work out the decimal value of a number;
- name the common data storage units and state that a byte is 8 bits.
What is a number base?
A number base is the number of different digits a number system uses before it starts a new place.
| System | Base | Digits used |
|---|---|---|
| Decimal | 10 | 0 to 9 |
| Binary | 2 | 0 and 1 |
| Octal | 8 | 0 to 7 |
| Hexadecimal | 16 | 0 to 9 and the letters A to F |
- Subscript: the small number after a value shows its base, for example 3710 or 1001012.
- Hexadecimal letters: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
What are positional weights?
A positional weight is the value of a digit’s place, written as a power of the base.
- Whole numbers: the place just left of the point has power 0, then 1, 2, 3 moving left.
- Fractions: the places right of the point have powers -1, -2, -3 moving right.
- Any base to the power 0: equals 1.
| Power | Base 2 | Base 8 | Base 16 |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 1 | 2 | 8 | 16 |
| 2 | 4 | 64 | 256 |
| 3 | 8 | 512 | 4096 |
| 4 | 16 | 4096 | 65536 |
How do you convert between decimal and binary?
Binary is base 2, so conversion uses division by 2 and powers of 2.
How do you convert decimal to binary?
Divide the decimal number by 2 until the quotient is zero, then read the remainders from the bottom upwards.
- Divide the number by 2.
- Write down the quotient and the remainder (0 or 1).
- Divide the quotient by 2 again.
- Stop when the quotient is 0.
- Read the remainders from the last to the first.
Example 1: Convert 3710 to binary.
Solution
| Division | Quotient | Remainder |
|---|---|---|
| 37 ÷ 2 | 18 | 1 |
| 18 ÷ 2 | 9 | 0 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
3710 = 1001012
Example 2: Convert 9310 to binary.
Solution
| Division | Quotient | Remainder |
|---|---|---|
| 93 ÷ 2 | 46 | 1 |
| 46 ÷ 2 | 23 | 0 |
| 23 ÷ 2 | 11 | 1 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
9310 = 10111012
How do you convert a decimal fraction to binary?
Convert the whole part by division, then convert the fractional part by repeated multiplication by 2.
- Convert the whole part by dividing by 2.
- Multiply the fractional part by 2.
- Write down the whole-number digit (0 or 1) of the answer.
- Multiply the remaining fraction by 2 again, until it becomes 0.
- Read the digits downwards after the point, then join both parts.
Example 3: Convert 25.62510 into a binary number.
Solution
First convert the whole part, 2510.
| Division | Quotient | Remainder |
|---|---|---|
| 25 ÷ 2 | 12 | 1 |
| 12 ÷ 2 | 6 | 0 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
2510 = 110012
Now convert the fractional part, 0.625.
| Multiplication | Result | Digit |
|---|---|---|
| 0.625 × 2 | 1.25 | 1 |
| 0.25 × 2 | 0.5 | 0 |
| 0.5 × 2 | 1.0 | 1 |
0.62510 = 0.1012
Therefore, 25.62510 = 11001.1012
How do you convert binary to decimal?
Multiply each binary digit by its power of 2, then add the results.
- Write the weight (power of 2) under each digit.
- Multiply each digit by 2 raised to its weight.
- Add all the products.
Example 1: Convert 101102 into a decimal number.
Solution: The binary number given is 1 0 1 1 02
Positional weights: 4 3 2 1 0
1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20
= 16 + 0 + 4 + 2 + 0 = 2210
Example 2: Convert 110112 to a decimal number.
Solution: The binary number given is 1 1 0 1 12
Positional weights: 4 3 2 1 0
1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
= 16 + 8 + 0 + 2 + 1 = 2710
Example 3: Convert 1010.0112 into a decimal number.
Solution: The binary number given is 1 0 1 0 . 0 1 12
Positional weights: 3 2 1 0 . -1 -2 -3
1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 + 0 × 2-1 + 1 × 2-2 + 1 × 2-3
= 8 + 0 + 2 + 0 + 0 + 0.25 + 0.125
1010.0112 = 10.37510
How do you convert between decimal and octal?
Octal is base 8, so conversion uses division by 8 and powers of 8.
How do you convert decimal to octal?
Repeatedly divide by 8, record each remainder (0 to 7) and read the answer upwards.
Example 1: Rewrite the decimal number 21510 as an octal number.
Solution
| Division | Quotient | Remainder |
|---|---|---|
| 215 ÷ 8 | 26 | 7 |
| 26 ÷ 8 | 3 | 2 |
| 3 ÷ 8 | 0 | 3 |
21510 = 3278
Example 2: Convert decimal 179210 to an octal number.
Solution
| Division | Quotient | Remainder |
|---|---|---|
| 1792 ÷ 8 | 224 | 0 |
| 224 ÷ 8 | 28 | 0 |
| 28 ÷ 8 | 3 | 4 |
| 3 ÷ 8 | 0 | 3 |
179210 = 34008
How do you convert octal to decimal?
Write each digit place as a power of 8, multiply, then add the results.
Example 1: Convert 3458 to a decimal number.
Solution: The octal number given is 3 4 5
Positional weights: 2 1 0
3458 = 3 × 82 + 4 × 81 + 5 × 80
= (3 × 64) + (4 × 8) + (5 × 1)
= 192 + 32 + 5 = 22910
Example 2: Convert 34628 into a decimal number.
Solution: The octal number given is 3 4 6 28
Positional weights: 3 2 1 0
3 × 83 + 4 × 82 + 6 × 81 + 2 × 80
= 1536 + 256 + 48 + 2 = 184210
Example 3: Convert 362.358 into a decimal number.
Solution: The octal number given is 3 6 2 . 3 5
Positional weights: 2 1 0 . -1 -2
3 × 82 + 6 × 81 + 2 × 80 + 3 × 8-1 + 5 × 8-2
= 192 + 48 + 2 + 0.375 + 0.078125
= 242.45312510
How do you convert between decimal and hexadecimal?
Hexadecimal is base 16, so conversion uses division by 16 and powers of 16.
How do you convert decimal to hexadecimal?
Divide the decimal number by 16 repeatedly, change any remainder from 10 to 15 into A to F, and read the remainders upwards.
Example 1: Convert 179210 to hexadecimal.
Solution
| Division | Quotient | Remainder |
|---|---|---|
| 1792 ÷ 16 | 112 | 0 |
| 112 ÷ 16 | 7 | 0 |
| 7 ÷ 16 | 0 | 7 |
179210 = 70016
Example 2: Rewrite the decimal number 21510 as a hexadecimal number.
Solution
215 ÷ 16 = 13, remainder 7
13 ÷ 16 = 0, remainder 1310 = D
Therefore, 21510 = D716
How do you convert hexadecimal to decimal?
Replace each letter with its value, multiply each digit by its power of 16, then add the results.
Example 1: Convert 42AD16 into a decimal number.
Solution: The hexadecimal number given is 4 2 A D (A = 10, D = 13)
Positional weights: 3 2 1 0
4 × 163 + 2 × 162 + 10 × 161 + 13 × 160
= 16384 + 512 + 160 + 13
= 1706910
Example 2: Convert 42A.1216 into a decimal number.
Solution: The hexadecimal number given is 4 2 A . 1 2
Positional weights: 2 1 0 . -1 -2
4 × 162 + 2 × 161 + 10 × 160 + 1 × 16-1 + 2 × 16-2
= 1024 + 32 + 10 + 0.0625 + 0.0078125
= 1066.070312510
How do computers store data?
Computers store information as 1s and 0s in storage such as memory, hard disks and USB drives.
- Bit: short for binary digit, the smallest unit of data a computer can store, either 1 (true) or 0 (false).
- Byte: the most common unit of digital data storage, equal to 8 bits.
- Kilobyte: 1 kilobyte is 1024 bytes, not 1000 bytes.
What are the data storage units?
The common data storage units, from smallest to largest, are the bit, byte, kilobyte, megabyte, gigabyte, terabyte and petabyte.
| Unit | Symbol | Size |
|---|---|---|
| Bit | b | One binary digit (0 or 1) |
| Byte | B | 8 bits |
| Kilobyte | KB | 1024 bytes |
| Megabyte | MB | 1024 kilobytes |
| Gigabyte | GB | 1024 megabytes |
| Terabyte | TB | 1024 gigabytes |
| Petabyte | PB | 1024 terabytes |
Evaluation
- What is a bit? How many bits make a byte?
- Convert 4510 to binary.
- Convert 101012 to a decimal number.
- Convert 15610 to an octal number.
- Convert 3A16 to a decimal number.
Assignment
Show full working for each conversion:
- Convert 5810 to binary.
- Convert 1101.12 to a decimal number.
- Convert 5748 to a decimal number.
- Convert 30010 to a hexadecimal number.
This term's Computer Studies topics
JSS2 First Term · 9 topics
Get Computer Studies as PDF and Word
Every week of JSS2 Computer Studies, First Term, formatted and ready to print. Ad-free, and the copy lock comes off.
Get this term Card, bank transfer, USSD or OPay

