Skip to content
Tactiverge

School/◇ Explorer/Week 15

Converting: binary to decimal and back

A robot's register shows 1001 1100. Is the motor speed high or low? First you need to translate.

About 30 min · 3 goals · Checked by automated tests; not yet reviewed by an educator

1.Why should I care?

Engineers constantly translate between how humans write numbers and how machines store them, when setting registers, reading sensor data or debugging. A quick, reliable method beats guessing.

  • ◇ Convert any binary number up to 8 bits into decimal.
  • ◇ Convert decimal numbers into binary using the 'biggest place that fits' method.
  • ◇ Check a conversion by converting back.

2.Predict

What is 13 in binary?

Guess first. Being wrong here is how the surprise works.

3.Discover

Open the Virtual Computer Build, Level 1. Show 13, 6 and 9 on the 4-bit register, then read 1010 and 0111 back into numbers. Before each one, say your answer, then check it on the lamps.

Can't use the interactive? Read a description instead

The Virtual Computer Build's Level 1 shows a 4-bit register as four lamps labelled 8, 4, 2 and 1. Turning lamps on shows a number: 13 is 8, 4 and 1 on (1101); 6 is 4 and 2 (0110); 9 is 8 and 1 (1001). Reading 1010 gives 10 and 0111 gives 7.

4.Understand

Binary → decimal: add the places

Write the place values above the bits, then add the place values that sit over a 1. For 1001 1100: places 128, 64, 32, 16, 8, 4, 2, 1. The 1s are under 128, 16, 8 and 4. Total: 128 + 16 + 8 + 4 = 156.

Decimal → binary: biggest place that fits

  1. Find the biggest place value that fits into your number. Put a 1 there.
  2. Subtract it.
  3. Repeat with what's left. Any place you skip gets a 0.

22: 16 fits (22 − 16 = 6). 8 doesn't (0). 4 fits (6 − 4 = 2). 2 fits (2 − 2 = 0). 1: 0. So 22 = 10110.

Always check by going back

Convert your answer back: 10110 → 16 + 4 + 2 = 22. ✔ It takes seconds and catches most mistakes. Engineers call this a round-trip check.

Explain it another way

Decimal → binary is like paying an amount with coins of 16, 8, 4, 2 and 1, always using the biggest coin you can first. The binary number is a list of which coins you used.

Worked example 1

Convert 37 to binary.

32 fits (37 − 32 = 5). 16: 0. 8: 0. 4 fits (5 − 4 = 1). 2: 0. 1 fits (0 left). So 37 = 100101. Check: 32 + 4 + 1 = 37 ✔.

Worked example 2

Convert 0110 1001 to decimal.

Ones are under 64, 32, 8 and 1: 64 + 32 + 8 + 1 = 105.

Common mix-ups

  • To convert to binary, just write the decimal digits in 0s and 1s.
    ✓ Binary is a different place-value system. Use the place values 1, 2, 4, 8… to rebuild the number.

5.Practice

Practice, not a test. Wrong answers get a hint and another try.

Practice 1 · a fresh version every time

What number is the binary pattern 1010 in ordinary (decimal) counting?

Practice 2 · a fresh version every time

Write 7 in binary. Type just the 0s and 1s with no leading zeros (for example, six is 110).

Practice 3

Convert the 8-bit binary number 10011100 to decimal.

Practice 4

Which is 9 in binary?

Practice 5

A classmate says 20 is 10010 in binary. What does a round-trip check show?

6.Apply it

Write your birthday (day and month) as binary numbers. Then encode a 3-digit secret number for a friend in binary and ask them to decode it and check by converting back.

Open BUILD 008: Create a Virtual Computer →

7.Reflect

Concepts: Binary, hexadecimal and digital signals