Skip to content
SPM Tuition
Computer Science · Computing systems and logic

Converting between denary and binary

You can follow a binary conversion in class but your answers come out reversed or one place off.

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.

Common questions

Which method should I use to convert denary to binary?

Either repeated division by 2 or subtracting place values from the largest down. Choose one and practise it until it is automatic, then use the other to check your answer. If two methods agree, an error is unlikely.

Why are remainders read from the bottom?

The first remainder is the ones place, the smallest place value, and the last remainder is the largest place. A binary number is written with the largest place on the left, so the list must be reversed.

What are the place values in binary?

From right to left: 1, 2, 4, 8, 16, 32, 64, 128 and so on, doubling each time. A binary digit of 1 means that place is counted, and a 0 means it is not.

Do I need hexadecimal?

Check the current syllabus from Lembaga Peperiksaan, or ask your school teacher, whether hexadecimal is assessed in your year. Learn binary and denary first either way.

If your conversions keep coming out reversed or one place off, one-to-one Computer Science lessons let a teacher watch your working and fix the step where the place values slip.

  • Online one-to-one lessons for your child with an experienced teacher.
  • Your first class is a one-hour trial, from RM50. The fee is agreed before you book.
  • Happy with the teacher? Continue with lessons of about 1.5 hours. If not, ask for another teacher.