This free online decimal to binary converter instantly translates any whole decimal (base-10) number into its binary (base-2) equivalent. Enter a non-negative whole number below to see the converted result right away.
Divide the number by 2 and write down the remainder, which is always 0 or 1. Divide the quotient by 2 again, and keep going until the quotient is 0. The remainders read from bottom to top are the binary number. Here is 156:
| Division | Quotient | Remainder |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading the remainder column upwards gives 10011100, which matches the converter's output for 156. The first remainder is the rightmost bit, so reversing the order is the step most often forgotten.
List the powers of 2 (128, 64, 32, 16, 8, 4, 2, 1). Starting from the largest one that fits, subtract it and write a 1 in that place; write a 0 for any power that does not fit. For 156: 156 − 128 = 28, 64 and 32 do not fit, 28 − 16 = 12, 12 − 8 = 4, 4 − 4 = 0, and 2 and 1 are not needed. The places give 1 0 0 1 1 1 0 0, the same 10011100. This method is quicker in your head for numbers up to a few hundred.
| Decimal | Bits in binary result |
|---|---|
| 100 | 7 |
| 255 | 8 |
| 1,000 | 10 |
| 1,00,000 | 17 |
| 10,00,000 | 20 |
A rule of thumb: every three decimal digits need about ten bits, because 2 to the power 10 is 1,024, just over 1,000.
The converter accepts whole numbers of zero or more. Computers usually store negative integers in two's complement. To find −54 as an 8-bit value, convert 54 to get 110110, pad it to 00110110, flip every bit to 11001001, then add 1 to get 11001010. A shortcut gives the same answer: convert 256 − 54 = 202 with this tool.
For a fractional part, multiply it by 2 repeatedly and take the whole-number digit each time. For 0.625: 1.25 gives 1, 0.5 gives 0, and 1.0 gives 1, so 0.625 is 0.101 in binary. Some fractions never end: 0.1 becomes 0.000110011 with the 0011 repeating forever, which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
Very large inputs have a limit too. Numbers up to 9007199254740991 (2 to the power 53, minus 1) convert exactly. Above that, the browser rounds the number before converting, so the last bits of the result may be wrong.