Skip to the tool
Binary Translator Free tools

Decimal to binary converter

A decimal to binary calculator that shows its work: type a decimal number to get it in binary, with the division steps.

Updated · Written and checked by Murugan Vellaichamy

Waiting for input

Prefixes 0b, 0o, 0x and spaces or underscores between digits are fine. A point starts the fraction.

Result
Try:

How to convert decimal to binary

Divide the number by 2 and write down the remainder, 0 or 1. Divide the quotient by 2 again, and keep going until the quotient is 0. The remainders, read from the last one to the first, are the binary digits.

DivideQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading the remainders from the bottom up gives 10011100, so 15610 = 100111002.

Negative numbers

Computers store negative whole numbers in two’s complement. To write −18 in 8 bits: write 18 in binary (00010010), flip every bit (11101101), then add 1 (11101110). Tick “Read as signed” in the converter and pick a width to get this directly.

Powers of 2

PowerDecimalBinary
2011
21210
224100
2381000
24161 0000
253210 0000
2664100 0000
271281000 0000
282561 0000 0000
2951210 0000 0000
2101,024100 0000 0000
2112,0481000 0000 0000
2124,0961 0000 0000 0000
2138,19210 0000 0000 0000
21416,384100 0000 0000 0000
21532,7681000 0000 0000 0000
21665,5361 0000 0000 0000 0000

How it’s calculated

Conversions use exact whole-number arithmetic (JavaScript BigInt), so long numbers keep every digit. Fractions are kept as exact ratios; when the digits repeat, the repeating block is found and marked instead of rounded.

Questions

How do I convert a decimal fraction to binary?

Multiply the fraction by 2. The whole-number part (0 or 1) is the next bit; keep the fraction part and repeat. 0.625 gives 1, 0, 1, so it is 0.101. Some fractions, like 0.1, never end in binary; the converter marks the repeating block.

How many bits do I need for a number?

A number below 2n fits in n bits. 255 fits in 8 bits, 65,535 in 16, and 4,294,967,295 in 32.

Why does 0.1 not convert exactly?

0.1 is 1/10, and 10 has a factor of 5, which binary can’t represent with a finite number of bits. The bits 0011 repeat forever.

More converters

Copied