Knowing how to convert decimal to binary is a core skill in computer science, networking and electronics exams. There are two reliable methods: repeated division by 2, which always works, and a powers-of-2 shortcut that is faster for small numbers. This guide shows both with worked examples.
Method 1: divide by 2
- Divide the number by 2. Write down the quotient and the remainder (0 or 1).
- Divide the quotient by 2 again, and write down the new remainder.
- Repeat until the quotient is 0.
- Read the remainders from bottom to top – that is the binary number.
Example: 13
| Division | Quotient | Remainder |
|---|---|---|
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: 1101.
Example: 45 – remainders 1, 0, 1, 1, 0, 1 → reading upwards: 101101.
The Decimal to Binary converter builds this table for any number you type, so you can check your homework line by line.
Method 2: subtract powers of 2
Write down the powers of 2: 128, 64, 32, 16, 8, 4, 2, 1. Starting from the largest that fits, subtract it and write a 1; write a 0 for each power you skip.
Example: 100
- 64 fits → 1 (100 − 64 = 36)
- 32 fits → 1 (36 − 32 = 4)
- 16 does not → 0
- 8 does not → 0
- 4 fits → 1 (4 − 4 = 0)
- 2 → 0
- 1 → 0
Result: 1100100. This is the "shortcut" many teachers show, and it is quick once you know the powers of 2.
Common values to remember
| Decimal | Binary |
|---|---|
| 1 | 1 |
| 2 | 10 |
| 5 | 101 |
| 8 | 1000 |
| 10 | 1010 |
| 15 | 1111 |
| 16 | 10000 |
| 100 | 1100100 |
| 127 | 1111111 |
| 255 | 11111111 |
Fractions
For numbers with a decimal point, convert the whole part as above, then multiply the fraction part by 2 repeatedly, taking the whole number each time. Our guide on how to convert fractional decimal to binary covers this step by step.
Checking your answer
Convert back: add the powers of 2 under every 1. For 1101 that is 8 + 4 + 0 + 1 = 13. See how to convert binary to decimal, or use the Binary to Decimal converter. For text rather than numbers, the Binary Converter turns letters into bits.
Why binary matters
Every piece of data inside a computer – numbers, text, images and sound – is stored as binary digits, or bits. Each bit is a tiny switch that is either off (0) or on (1). Groups of eight bits form a byte, which can hold 256 different values. Understanding how to turn ordinary numbers into binary helps with networking (subnet masks such as 255.255.255.0 are 11111111.11111111.11111111.00000000), with file sizes and with low-level programming.
Practice examples
Try these yourself, then check with the converter:
- 7 → 111
- 20 → 10100
- 33 → 100001
- 64 → 1000000
- 200 → 11001000
If you get a different answer, work through the divide-by-2 table again and make sure you read the remainders from the bottom up – reading them top to bottom is the most common mistake.
Frequently asked questions
How many bits do I need for a number? n bits can hold numbers up to 2ⁿ − 1. Eight bits hold 0–255; sixteen bits hold 0–65,535.
Do I need leading zeros? Only when a fixed width is required, such as 8 bits for a byte: 13 becomes 00001101.
How do I convert negative numbers? Computers usually use two's complement: write the positive number in a fixed number of bits, invert every bit, then add 1. For −13 in 8 bits: 00001101 → 11110010 → 11110011.
Which method is best in an exam? Divide by 2 is the safest because it always works. The powers-of-2 method is faster once you are confident.
Now you know how to convert decimal to binary two ways – and how to check the answer.