Decimal to Binary
Convert decimal numbers to binary instantly.
How to use this tool
- Enter decimal in the fields above.
- Results update instantly as you type — or click Calculate.
- Read your binary and the full breakdown beneath it.
Convert decimal numbers to binary instantly.
Formula
Binary = successive division of the decimal number by 2, reading remainders from bottom to top
binary = decimal.toString(2)
For example, 10 ÷ 2 = 5 R0, 5 ÷ 2 = 2 R1, 2 ÷ 2 = 1 R0, 1 ÷ 2 = 0 R1 → read remainders upward: 1010.
How it works
Repeatedly divide the decimal integer by 2, recording each remainder (0 or 1). When the quotient reaches 0, stop. The binary representation is the sequence of remainders read in reverse order — from last remainder to first. This is equivalent to calling JavaScript's Number.prototype.toString(2).
Common mistake: Reading the remainders in the order they were produced (top to bottom) rather than reversing them (bottom to top) gives a mirrored, incorrect binary number.
Worked example
Convert decimal 10 to binary
- Divide 10 by 2: quotient 5, remainder 0.
- Divide 5 by 2: quotient 2, remainder 1.
- Divide 2 by 2: quotient 1, remainder 0.
- Divide 1 by 2: quotient 0, remainder 1. Read remainders bottom to top: 1, 0, 1, 0.
1010 — decimal 10 equals binary 1010.
Common mistakes to avoid
- Reading the remainders from top to bottom (in the order they were computed) instead of bottom to top, which reverses the bit order.
- Stopping the division too early — the process must continue until the quotient reaches 0.
- Trying to convert negative decimals without applying two's-complement notation, resulting in an incorrect unsigned binary string.
Key terms
- Decimal (base-10)
- The everyday number system using digits 0–9 with each position representing a power of 10.
- Binary (base-2)
- A number system using only 0 and 1, fundamental to digital computing and electronics.
- Remainder
- What is left over after integer division; in binary conversion each remainder is either 0 or 1.
- Radix
- The base of a number system — 10 for decimal, 2 for binary, 16 for hexadecimal.
Frequently asked questions
- What is decimal 255 in binary?
- 11111111 — eight 1-bits, the maximum value of an unsigned byte.
- How many binary digits does a decimal number need?
- Roughly floor(log2(n)) + 1 bits. For example, 100 in decimal needs 7 bits (1100100).
- Does the converter handle 0?
- Yes — decimal 0 converts to binary 0.