Binary is a place-value system that doubles at each step instead of multiplying by ten. Once you can list the place values, both conversions are short and easy to check.
This lesson starts computing systems and logic. If you also want to tell size from value, see distinguishing representation size from the value represented.
What are the place values?
Write the place values above the digits, starting from the right with 1 and doubling each step.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
Each binary digit says whether to count that place: 1 means count it and 0 means skip it.
Worked example 1: binary to denary
Convert 11010 to denary. Write it under the place values.
| 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|
| 1 | 1 | 0 | 1 | 0 |
Add the places with a 1: 16 + 8 + 2 = 26. The 4 and the 1 are skipped because their digits are 0.
Worked example 2: denary to binary by division
Convert 26 to binary by dividing by 2 and keeping each remainder.
| Division | Quotient | Remainder |
|---|---|---|
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Stop when the quotient reaches 0. Read the remainders from the bottom up: 1, 1, 0, 1, 0. The answer is 11010, which matches example 1.
The mistake: reading the remainders from the top
A common slip is to read the remainders in the order you found them. The division is correct and only the last step goes wrong.
| Reading | Digits | Value |
|---|---|---|
| Top to bottom | 0, 1, 0, 1, 1 | 01011 = 8 + 2 + 1 = 11 |
| Bottom to top | 1, 1, 0, 1, 0 | 11010 = 26 |
The top-to-bottom reading gives 11, not 26. The first remainder answers “is it odd?”, so it belongs in the ones place on the right, not on the left.
A check that takes ten seconds
After any conversion, convert your answer back. If 11010 gives 16 + 8 + 2 = 26, the number you started with, the answer is right. If the result differs, find the step that went wrong.
A quick size test also helps. The largest value in n bits is 2ⁿ − 1, so a 5-bit answer must be 31 or less. If your 5-digit answer stands for more than 31, a digit is misplaced.
Check yourself
(a) Convert 37 to binary. (b) Convert 10110 to denary.
Answer
(a) Subtract place values from the largest that fits. 32 fits into 37, leaving 5. 16 and 8 do not fit.
Then 4 fits, leaving 1. 2 does not fit, and 1 fits, leaving 0. The places used are 32, 4 and 1, so the answer is 100101.
Check by division: 37 gives remainders 1, 0, 1, 0, 0, 1 in order, and reading from the bottom gives 100101.
(b) Place values 16, 8, 4, 2, 1 with digits 1, 0, 1, 1, 0. Add 16 + 4 + 2 = 22.
What to study next
Continue with reading Boolean expressions and truth tables, which works on single bits, then test yourself in the practice set. Log any reversal slips in the mistake log and paper-error review.
If you want a teacher to watch your conversions and correct the step that slips, see online one-to-one Computer Science tuition.