Decimal to Binary Converter
Going the other way? Convert binary back to decimal →
How do you convert decimal to binary?
Decimal to binary conversion divides the number by 2 over and over, keeping each remainder, then reads the remainders from the last one back to the first.
Decimal 156 is binary 10011100. Divide by 2 repeatedly, record each remainder, stop when the quotient is 0, then read the remainders from last to first.
- Divide the number by 2 and write down the remainder. 156 ÷ 2 leaves 0.
- Divide the quotient by 2 again and keep that remainder too.
- Repeat until the quotient reaches 0.
- Read the remainders from bottom to top: 156 = 10011100.
Decimal to Binary Conversion Table
Every position in a binary number is worth twice the one to its right. Binary writes values on the digit set 0, 1, each place worth 2ⁿ, and a value marked with the 0b prefix is binary. A byte is 8 bits and holds 256 values, 0–255; a nibble is 4 bits. Add the weights under the 1s and you have the decimal value; divide by 2 and keep remainders to go the other way.
| Position | Weight | Value |
|---|---|---|
| 15 | 2^15 | 32768 |
| 14 | 2^14 | 16384 |
| 13 | 2^13 | 8192 |
| 12 | 2^12 | 4096 |
| 11 | 2^11 | 2048 |
| 10 | 2^10 | 1024 |
| 9 | 2^9 | 512 |
| 8 | 2^8 | 256 |
| 7 | 2^7 | 128 |
| 6 | 2^6 | 64 |
| 5 | 2^5 | 32 |
| 4 | 2^4 | 16 |
| 3 | 2^3 | 8 |
| 2 | 2^2 | 4 |
| 1 | 2^1 | 2 |
| 0 | 2^0 | 1 |
Each base is defined by three things: which digits it uses, how a value is marked, and what each position is worth.
| Base | Radix | Digits | Prefix | Place worth | Typical range |
|---|---|---|---|---|---|
| Decimal | 10 | 0–9 | none | 10ⁿ | any; decimal pages treat 0–255 as the byte range |
| Binary | 2 | 0, 1 | 0b | 2ⁿ | 8-bit byte 0–255 (00000000–11111111); 4-bit nibble 0–15; 16/32/64-bit words |
Worked Example: 156 to Binary
One value, converted the long way so the working is visible. This is the same grid the converter shows when you turn on "show steps".
Result: 156 = 10011100
Divide by 2 and keep the remainder, then divide the quotient again, until the quotient reaches 0. For 156 that runs: 156 / 2 = 78 remainder 0; 78 / 2 = 39 remainder 0; 39 / 2 = 19 remainder 1; 19 / 2 = 9 remainder 1, and on down to 0.
The remainders come out least significant first, so they are read from the bottom of the list back to the top: 10011100. Reading them the other way is the single most common error, and it gives a number that looks plausible and is wrong. The check is quick — expand the result back and it must return 156.
Check it in reverse
The value returns unchanged. Convert 10011100 back and you get 156, because a base change rewrites the digits without touching the quantity they stand for. That is the whole test: if the round trip differs, a digit was misread. To check it by hand, check the value by converting binary back to decimal and compare it with the number you started from.
Worked examples: decimal to binary
Each example gives the value first, then the working. Click a value to load it in the converter.
What is 224 in binary?
224 in decimal is 11100000 in binary.
Method: divide 224 by 2 repeatedly and read the remainders bottom to top.
What is 2 in binary?
2 in decimal is 10 in binary.
Method: divide 2 by 2 repeatedly and read the remainders bottom to top.
What is 156 in binary?
156 in decimal is 10011100 in binary.
Method: divide 156 by 2 repeatedly and read the remainders bottom to top.
What is 45 in binary?
45 in decimal is 101101 in binary.
Method: divide 45 by 2 repeatedly and read the remainders bottom to top.
What is 251 in binary?
251 in decimal is 11111011 in binary.
Method: divide 251 by 2 repeatedly and read the remainders bottom to top.
What is 10 in binary?
10 in decimal is 1010 in binary.
Method: divide 10 by 2 repeatedly and read the remainders bottom to top.
What is 100 in binary?
100 in decimal is 1100100 in binary.
Method: divide 100 by 2 repeatedly and read the remainders bottom to top.
What is 255 in binary?
255 in decimal is 11111111 in binary.
Method: divide 255 by 2 repeatedly and read the remainders bottom to top.
What is 8 in binary?
8 in decimal is 1000 in binary.
Method: divide 8 by 2 repeatedly and read the remainders bottom to top.
What is 16 in binary?
16 in decimal is 10000 in binary.
Method: divide 16 by 2 repeatedly and read the remainders bottom to top.
What is 32 in binary?
32 in decimal is 100000 in binary.
Method: divide 32 by 2 repeatedly and read the remainders bottom to top.
What is 64 in binary?
64 in decimal is 1000000 in binary.
Method: divide 64 by 2 repeatedly and read the remainders bottom to top.
What is 128 in binary?
128 in decimal is 10000000 in binary.
Method: divide 128 by 2 repeatedly and read the remainders bottom to top.
What is 12 in binary?
12 in decimal is 1100 in binary.
Method: divide 12 by 2 repeatedly and read the remainders bottom to top.
What is 15 in binary?
15 in decimal is 1111 in binary.
Method: divide 15 by 2 repeatedly and read the remainders bottom to top.
What is 20 in binary?
20 in decimal is 10100 in binary.
Method: divide 20 by 2 repeatedly and read the remainders bottom to top.
What is 25 in binary?
25 in decimal is 11001 in binary.
Method: divide 25 by 2 repeatedly and read the remainders bottom to top.
What is 50 in binary?
50 in decimal is 110010 in binary.
Method: divide 50 by 2 repeatedly and read the remainders bottom to top.
What is 200 in binary?
200 in decimal is 11001000 in binary.
Method: divide 200 by 2 repeatedly and read the remainders bottom to top.
What is 1000 in binary?
1000 in decimal is 1111101000 in binary.
Method: divide 1000 by 2 repeatedly and read the remainders bottom to top.
Every example above reverses exactly — read the same bits back as decimal.
What About Padding, Fractions and Width?
Leading zeros and width
A number carries no leading zeros unless a width is fixed. 10011100 and 010011100 are the same value, so the converter writes the short form. Fixed widths belong to bytes and registers, not to arithmetic. how to write a negative number in binary covers where width does matter.
Fractions and the point
Digits after a point convert by the same rule with negative powers, so the first place after the point is worth 1/2. Many fractions that end neatly in decimal repeat forever in binary, which is where rounding creeps in.
Negative values
A minus sign is kept in front of the digits. Fixed-width binary encodes sign differently, using two's complement, and that is a separate rule from the base change itself.
How large a value can be
The method has no ceiling; each extra decimal digit multiplies the range by 10. Practical limits come from the width a machine stores the value in, not from the conversion.
Decimal to Binary in Code
The same rule in one line. Both divide repeatedly and return the digits in order.
Python: format(156, 'b') JavaScript: (156).toString(2) Common Mistakes
- Reading the remainders top to bottom. They come out in reverse, so the digits land backwards.
- Using a digit the base does not have — an 8 in octal, or a 2 in binary. The value cannot be read at all.
- Grouping bits from the left. Groups are counted from the right, and the leftmost group is the one that gets padded.
- Treating the result as a character code. 65 is a number here, not the letter A.
Frequently Asked Questions
How do you convert a decimal fraction to binary?
Multiply the fraction by 2 over and over and write down each whole part, then read those digits from the top down. 0.75 doubles to 1.5 and then to 1.0, so it is 0.11. Many fractions never end and have to be cut off at a chosen width.
Can you convert a negative decimal to binary?
Yes, in two ways. Outside a fixed width the minus sign stays in front of the digits. Inside 8 bits, two's complement carries the sign: −5 is 11111011. 11111111 is 255 as an unsigned 8-bit number (0xFF, 0o377). Read as 8-bit two's complement it is −1; the 8-bit signed range is −128 to 127.
What is the powers-of-two (subtraction) method?
It builds the number from the largest power of two downwards. For 156, take 128, then 16, then 8, then 4: those add to 156, and writing a 1 in each place used gives 10011100.
How many binary digits does a decimal number need?
Enough to cover the value: n bits hold 0 to 2ⁿ − 1, so 8 bits reach 255 and 10 bits reach 1023. 156 needs 8 bits, and a machine then rounds that up to a fixed width, for the reasons in where binary code comes from.
How do you convert decimal to binary in Python?
Format the number in base 2: format(156, 'b') returns the bare digits, and bin(156) returns them behind the 0b prefix. The first is the one-liner under Decimal to Binary in Code.
The round trip is exact, so the same value converts straight back in the binary to decimal direction.
Related Conversions
The rest of the family sits on the whole binary and text converter set.