Skip to main content

How to Convert Decimal to Binary (Step by Step)

RA
Rafsan Alhad Founder & Editorial Director
3 min read

Converting decimal to binary is the reverse of binary-to-decimal: instead of adding powers of 2, you subtract them. The most reliable method is repeated division by 2, and it works for any whole number. This guide covers that method plus a faster subtraction shortcut, with examples you can check by hand.

The Division-by-2 Method

The algorithm is simple:

  1. Divide the decimal number by 2
  2. Write down the remainder (0 or 1)
  3. Repeat with the quotient until you reach 0
  4. Read the remainders bottom to top – that’s your binary number

Worked Example: 13 to Binary

Converting 13:

Division Quotient Remainder
13 ÷ 2 6 1
6 ÷ 2 3 0
3 ÷ 2 1 1
1 ÷ 2 0 1

Reading remainders bottom to top: 1101. Verify: 8 + 4 + 1 = 13. ✓

Worked Example: 42 to Binary

Converting 42:

Division Quotient Remainder
42 ÷ 2 21 0
21 ÷ 2 10 1
10 ÷ 2 5 0
5 ÷ 2 2 1
2 ÷ 2 1 0
1 ÷ 2 0 1

Reading bottom to top: 101010. Verify: 32 + 8 + 2 = 42. ✓

The Subtraction Shortcut

For mental math, the subtraction method is often faster:

  1. Find the largest power of 2 that fits in your number
  2. Write 1 in that position and subtract
  3. Repeat with the remainder

Converting 25:

  • Largest power of 2 ≤ 25 is 16 → write 1, remainder 9
  • Largest power of 2 ≤ 9 is 8 → write 1, remainder 1
  • Positions 4 and 2 don’t fit → write 0, 0
  • Largest power of 2 ≤ 1 is 1 → write 1, remainder 0

Result: 11001. Verify: 16 + 8 + 1 = 25. ✓

This method also teaches you why binary works: every number is a unique sum of powers of 2.

Converting Decimal Fractions to Binary

For the fractional part, multiply by 2 repeatedly and record the integer part:

Converting 0.625:

Step Multiply by 2 Integer part
0.625 × 2 = 1.25 1.25 1
0.25 × 2 = 0.5 0.5 0
0.5 × 2 = 1.0 1.0 1

Reading top to bottom: 0.101. Verify: 0.5 + 0.125 = 0.625. ✓

Note: some fractions (like 0.1) never terminate in binary – they repeat forever, just like ⅓ repeats in decimal.

Why This Method Always Works

The division-by-2 method isn’t a trick – it’s a direct consequence of how positional number systems work. Every time you divide by 2, the remainder tells you whether the current least-significant bit is 0 or 1, and the quotient is the number with that bit stripped off. Repeating the process peels off bits from right to left, which is why you read the remainders bottom-to-top to reconstruct the number left-to-right.

This also explains why the method terminates: each division roughly halves the number, so even a billion needs only about 30 steps (2³⁰ ≈ 1.07 billion). For everyday numbers under 256, you’ll never need more than 8 divisions.

One more useful property: the number of divisions equals the number of bits in the answer (except for 0, which is a special case). So if you did 6 divisions converting 42, you know the answer is 6 bits long – a quick sanity check against dropped digits.

How Many Bits Do You Need?

A quick way to know the binary length of a number:

Decimal range Bits needed
0 – 1 1
0 – 3 2
0 – 7 3
0 – 15 4
0 – 31 5
0 – 255 8
0 – 65,535 16

The rule: n bits can represent 0 through 2ⁿ − 1. So 255 needs 8 bits because 2⁸ − 1 = 255.

Rather than doing long division by hand every time, try our binary converter – it converts decimal to binary instantly and shows the division steps.

Frequently Asked Questions

What is 10 in binary?

10 = 8 + 2, so 1010. A common beginner mistake is writing 101 (that’s 5).

What is 100 in binary?

100 = 64 + 32 + 4, so 1100100. Verify: 64 + 32 + 4 = 100. ✓

How do you convert 0 to binary?

Just 0. The division method gives quotient 0 immediately with no remainders, so the answer is a single 0.

Why do programmers group binary in fours?

Because 4 bits = 1 hexadecimal digit. Grouping 1100100 as 0110 0100 gives 0x64, which is much easier to read. Our binary converter displays hex alongside binary for exactly this reason.

Does the division method work for very large numbers?

Yes – it works for any positive integer. For numbers above 2³², just keep dividing; the method has no upper limit.

Interactive Utilities

Related Interactive Calculators & Tools

Browse 2,700+ Tools →
Developer Free & Client-Side

Binary to Decimal Converter — Free Online with Place-Value Steps

Convert binary to decimal and decimal to binary free. Interactive place-value bead visualizer, step-by-step working, binary fractions, bit grouping. 100% private — runs entirely in your browser.

Launch Tool →
Converters Free & Client-Side

MB to GB Converter - Convert Megabytes to Gigabytes (Decimal and Binary)

Convert MB to GB and GB to MB instantly. Honest decimal (SI: 1 GB = 1000 MB) and binary (IEC: 1 GiB = 1024 MiB) modes, live KB MB GB TB PB panel, precision control, and real-world file size context.

Launch Tool →
Converters Free & Client-Side

Decimal to Octal Converter | Free Online Base 8 Conversion Tool

Free decimal to octal converter: convert decimal to octal and octal to decimal instantly, with long-division steps, a 0-64 octal chart, and Unix chmod permission context.

Launch Tool →