Skip to content
CodeShift
Menu

How to Convert Decimal to Binary

Divide by 2 repeatedly and read remainders bottom-up. Decimal 25 becomes 11001, decimal 100 becomes 1100100. Full step-by-step method inside.

By The CodeShift DeskPublished September 13, 2026

To convert a decimal number to binary, divide it by 2 repeatedly and collect the remainders. Read those remainders from the last division to the first — that sequence is the binary number. Decimal 25 converts to 11001 in four division steps.

The Division Method

Here is the full conversion for 25:

Step Dividend ÷ 2 Quotient Remainder
1 25 ÷ 2 12 1
2 12 ÷ 2 6 0
3 6 ÷ 2 3 0
4 3 ÷ 2 1 1
5 1 ÷ 2 0 1

Read the remainders from bottom to top: 1, 1, 0, 0, 1 → 11001.

Check: 16 + 8 + 0 + 0 + 1 = 25. ✓

Second Example: Converting 100

Step Dividend Quotient Remainder
1 100 50 0
2 50 25 0
3 25 12 1
4 12 6 0
5 6 3 0
6 3 1 1
7 1 0 1

Bottom to top: 1, 1, 0, 0, 1, 0, 0 → 1100100.

Check: 64 + 32 + 0 + 0 + 4 + 0 + 0 = 100. ✓

As a padded 8-bit byte: 01100100.

The Subtraction Method (Alternative)

Start from the largest power of 2 that fits into your number. Write a 1, subtract, then repeat for the remainder. Fill every skipped power of 2 with a 0.

Converting 156:

Power of 2 Value Fits? Bit Running total
2⁷ 128 Yes 1 156 − 128 = 28
2⁶ 64 No 0 28
2⁵ 32 No 0 28
2⁴ 16 Yes 1 28 − 16 = 12
2³ 8 Yes 1 12 − 8 = 4
2² 4 Yes 1 4 − 4 = 0
2¹ 2 No 0 0
2⁰ 1 No 0 0

Reading top to bottom: 10011100. Check: 128 + 16 + 8 + 4 = 156. ✓

Quick Reference: Common Decimal-to-Binary Conversions

Decimal Binary Notes
0 00000000 All zeros
1 00000001 Lowest non-zero byte
10 00001010 Decimal ten
16 00010000 First power of 2 above 15
32 00100000 Space character in ASCII
65 01000001 Letter A in ASCII
128 10000000 Half of 255
255 11111111 Max single-byte value

Converting Text to Binary

To convert a word to binary, convert each character’s ASCII decimal code to binary. For “Hi”:

  • H = 72 = 01001000
  • i = 105 = 01101001

Full binary string: 01001000 01101001

Use the binary translator to convert any text or number instantly. For the reverse — reading a binary number back to decimal — see How to Read Binary.

When to Pad to 8 Bits

In data transmission and storage, individual bytes are always 8 bits wide. If your conversion produces fewer than 8 digits (as with 25 = 11001), pad with leading zeros to get 00011001. This ensures every character occupies exactly one byte in memory, avoiding misalignment errors when computers read a file.

Frequently asked questions

What is the fastest way to convert decimal to binary in your head?+

Subtract the largest power of 2 that fits, write a 1, then repeat for the remainder. For 25: 16 fits (1), remainder 9; 8 fits (1), remainder 1; 1 fits (1). Result: 11001.

How do I convert decimal to binary without a calculator?+

Use repeated division by 2. Write the remainders from each division, then read them from bottom to top. That sequence is your binary number.

Does decimal 0 have a binary representation?+

Yes — decimal 0 is simply 0 in binary. As an 8-bit byte it is written 00000000.

What is 255 in binary?+

255 in binary is 11111111 — eight 1s. It is the highest value a single byte can hold.

How do I convert binary back to decimal?+

Multiply each binary digit by its positional power of 2 and add the results. For 11001: (1×16) + (1×8) + (0×4) + (0×2) + (1×1) = 25.

Keep reading