Decimal ↔ Binary Converter
Enter a decimal number to convert to binary, or a binary number to convert to decimal. The result will appear in the other box.
Binary is a base-2 number system, meaning it only uses two digits: 0 and 1. Each position in a binary number represents a power of 2, starting from 2 0 (which is 1) on the rightmost side.
For example, the binary number 1101 is calculated as:
1 × 2^3 + 1 × 2^2 + 0 × 2^1 + 1 × 2^0 = 8 + 4 + 0 + 1 = 13 (in decimal).
How to use Decimal ↔ Binary Converter
- 1
Enter a number
Type a decimal number into the Decimal Value box, or a binary number into the Binary Value box.
- 2
See the conversion
The matching result appears instantly in the other field as you type, with no button to press.
- 3
Review the steps
Check the Conversion Steps section to follow the division-by-2 process that produces the binary result.
- 4
Copy the result
Use Copy Decimal or Copy Binary to grab the value, or Swap to reverse the conversion direction.
Converting Decimal to Binary
From base 10 to base 2
Decimal is the base-10 number system built from ten digits, 0 through 9, that people use every day. Binary is the base-2 system built from only two digits, 0 and 1, that computers use internally because their circuits have two stable states. Converting a decimal number to binary expresses the same quantity in the form a machine stores it; the value is unchanged, only the notation differs. Decimal 13 and binary 1101 are the same amount.
There are two reliable ways to do the conversion by hand: repeated division by two, which builds the binary digits from the bottom up, and subtracting powers of two, which builds them from the top down. Both give the same answer. This tool shows the division method step by step so you can follow exactly how the result is produced rather than just seeing the final string of bits.
The repeated-division method
The division method works because each division by two peels off one binary digit. You divide the number by two, write down the remainder (which is always 0 or 1), then divide the quotient by two and record its remainder, and you keep going until the quotient reaches zero. The remainders are the binary digits, but they come out least-significant first, so the final step is to read them in reverse — from the last remainder back to the first.
The logic is the mirror image of place values. Dividing by two asks how many twos fit into the number, and the remainder tells you whether the ones bit is set; the next division shifts everything down one binary place and asks about the twos bit, and so on. Because every step produces exactly one bit, a number needs as many divisions as it has binary digits.
Worked example: 13 to binary
Convert decimal 13 by repeated division. Divide 13 by 2 to get a quotient of 6 with a remainder of 1. Divide 6 by 2 to get 3 remainder 0. Divide 3 by 2 to get 1 remainder 1. Divide 1 by 2 to get 0 remainder 1. The quotient is now zero, so you stop.
Collect the remainders in the order produced — 1, 0, 1, 1 — then reverse them to read most-significant first, giving 1101. So decimal 13 is binary 1101. You can confirm it with place values: 1101 is 8 + 4 + 0 + 1, which sums right back to 13. The Conversion Steps panel in this tool lays out each of these divisions for you.
The powers-of-two method
The second approach builds the answer from the top down using place values. List the powers of two that do not exceed your number — 1, 2, 4, 8, 16, 32, 64, 128, and so on — then find the largest one that fits, subtract it, and repeat with the remainder. Each power you use places a 1 in that column, and each power you skip places a 0.
For 13, the largest power of two that fits is 8, leaving 5. The largest power that fits in 5 is 4, leaving 1. Four does not divide it further, two is too big, and 1 fits exactly, leaving 0. So you used the 8, 4, and 1 columns and skipped the 2 column, which gives 1101 — the same result as the division method. Many people find this approach faster once they know the powers of two by heart.
Padding, leading zeros, and byte widths
The bare binary form of a number has no leading zeros, just as decimal 13 is not written 0013. But computers store numbers in fixed-width slots, so the same value is often padded on the left to a standard size. As a byte, 13 is written 00001101 — the meaningful bits 1101 with four leading zeros to fill eight positions. The zeros do not change the value; they only pad it to width.
Choosing a width matters because it sets the range of values that fit. Eight bits hold 0 to 255, sixteen bits hold 0 to 65535, and so on. When you convert here, you get the natural binary representation, and you can mentally pad it to whatever width your context needs. This tool also guards against numbers so large they exceed safe integer precision, rejecting them rather than returning an inaccurate result.
Negative numbers and fractions
This converter works with non-negative whole numbers, which is the case you meet most often. It is worth knowing, though, how the two harder cases are handled elsewhere. Computers do not store a literal minus sign; instead they represent negative integers with a scheme called two's complement, in which the most significant bit indicates the sign and the negative value is encoded by inverting the bits and adding one within a fixed width.
Fractions use a different mechanism again. The part after the binary point is built from negative powers of two — one half, one quarter, one eighth, and so on — and most decimal fractions, such as 0.1, cannot be written exactly in binary, which is the root cause of the small rounding errors you sometimes see in floating-point arithmetic. For everyday whole-number conversion, the division and powers-of-two methods above are all you need.
Where it is useful
Decimal-to-binary conversion is a core skill in computer-science education and a common exam question, because it makes the relationship between human numbers and machine storage concrete. Once you can turn 13 into 1101 by hand, ideas like data sizes, integer overflow, and bit manipulation become much easier to follow.
It is practical, too. Programmers convert decimal values into binary to set bit flags, build bit masks, and reason about low-level data. Network engineers turn decimal IP octets into binary to work out subnet boundaries. Digital-electronics and microcontroller work constantly moves between the decimal numbers people specify and the binary patterns the hardware actually uses, and a quick, step-by-step converter keeps that translation accurate.
Frequently asked questions
Does it convert both directions?
Can I see how the conversion is calculated?
What counts as valid binary input?
Is there a limit on how large a number can be?
Is my data kept private?
Related tools
Keep going with these handy tools