Ekuation

conversion

Decimal to Binary Converter

Convert decimal numbers to binary. See the repeated division method step-by-step with remainders reading bottom to top.

Back to Number Base Converter

Enter a decimal number (digits 0-9).

Maximum fractional digits for non-terminating expansions.

Number Base Conversion Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

ASCII Letter A

Convert the ASCII code for uppercase A (65) across all bases.

Key values: Decimal 65 · Binary 1000001 · Hex 41

Byte Maximum

The largest value a single byte can hold (255).

Key values: Decimal 255 · Binary 11111111 · Hex FF

Hex Color Code

Convert a common hex color code (deep sky blue) to other bases.

Key values: Hex 00BFFF · Decimal 49151 · Binary nibbles

Documentation

The Division Method

Repeatedly divide the decimal number by 2 and record the remainders. The binary result is the remainders read bottom to top:

25÷2=12 R 112÷2=6 R 06÷2=3 R 03÷2=1 R 11÷2=0 R 1\begin{aligned} 25 \div 2 &= 12 \text{ R } \mathbf{1} \\ 12 \div 2 &= 6 \text{ R } \mathbf{0} \\ 6 \div 2 &= 3 \text{ R } \mathbf{0} \\ 3 \div 2 &= 1 \text{ R } \mathbf{1} \\ 1 \div 2 &= 0 \text{ R } \mathbf{1} \end{aligned}

Reading remainders bottom-to-top: 2510=11001225_{10} = 11001_2.


The Subtraction Method

Find the largest power of 2 that fits, subtract it, and repeat. Each power used is a 1 bit; each skipped power is a 0:

  1. 2516=925 - 16 = 9 → bit at 242^4 = 1
  2. 98=19 - 8 = 1 → bit at 232^3 = 1
  3. 22=4>12^2 = 4 > 1 → bit at 222^2 = 0
  4. 21=2>12^1 = 2 > 1 → bit at 212^1 = 0
  5. 11=01 - 1 = 0 → bit at 202^0 = 1

Result: 11001211001_2 — same answer, more intuitive for some learners.


How Many Bits Do You Need?

The number of bits required to represent a decimal number nn is:

bits=log2n+1\text{bits} = \lfloor \log_2 n \rfloor + 1
Decimal rangeBits neededCommon name
0–11Bit
0–154Nibble
0–2558Byte
0–65,53516Word (16-bit)
0–4,294,967,29532Double word

Negative Numbers: Two's Complement

Computers represent negative integers using two's complement: invert all bits, then add 1. For 8-bit numbers:

25:00011001invert11100110+111100111-25: \quad 00011001 \xrightarrow{\text{invert}} 11100110 \xrightarrow{+1} 11100111

Why two's complement? It lets the same addition circuit handle both positive and negative numbers. The hardware doesn't need separate logic for subtraction — it just adds the two's complement.


Frequently Asked Questions

How do you convert decimal to binary?

Use the repeated division method: divide the number by 2, record the remainder, replace the number with the quotient, and repeat until the quotient is 0. Read the remainders from bottom to top for the binary result.

Is there a faster way to convert decimal to binary?

Yes, the subtraction method: find the largest power of 2 that fits, subtract it (that bit is 1), and repeat with the remainder. Each skipped power of 2 is a 0 bit. This can be more intuitive than repeated division.

How many bits do I need to represent a decimal number?

The formula is log2(n)+1\lfloor \log_2(n) \rfloor + 1 bits. Common ranges: 0–15 needs 4 bits (nibble), 0–255 needs 8 bits (byte), 0–65,535 needs 16 bits (word), and 0–4,294,967,295 needs 32 bits.

How do computers represent negative numbers in binary?

Most modern computers use two's complement: invert all bits and add 1. For example, 25-25 in 8-bit binary is computed as 00011001 → invert → 11100110 → add 1 → 11100111.

Why is two's complement used instead of sign-magnitude?

Two's complement lets the same addition circuit handle both positive and negative numbers. The hardware does not need separate logic for subtraction; it simply adds the two's complement of the number being subtracted.

Related conversion Variants

Explore more conversion options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators