Home › Decimal to Binary Converter

Decimal to Binary Converter

Type a decimal number to get it in binary, with every step of the division shown, plus hex and octal. It handles very large numbers, decimal fractions and negative numbers.

Binary
Hex
Octal

How to convert decimal to binary

  1. Divide the number by 2. Write down the whole-number answer and the remainder (0 or 1).
  2. Divide that answer by 2 again, and keep going until the answer is 0.
  3. Read the remainders from the last one to the first. That is the binary number.

The table below does this for the number you typed. For 156 the remainders, read from the bottom up, are 1001 1100.

DivideAnswerRemainder

Binary to decimal

Decimal
Hex

Binary to decimal, by hand

Each binary digit is worth a power of 2, counting from 0 on the right: 1, 2, 4, 8, 16, 32 and so on. Add up the values of the places that hold a 1. For 1001 1100 that is 128 + 16 + 8 + 4 = 156.

Binary to hex

Hex is binary in groups of four. Split the binary number into groups of four digits from the right and replace each group with one hex digit: 0000 = 0, 1001 = 9, 1010 = A, 1111 = F. That is why the converter shows binary in groups of four: 1001 1100 is 9C in hex.

Negative numbers and two's complement

Type a minus sign and the converter shows the plain binary with a minus, plus the two's complement form that computers use for 8, 16, 32 and 64 bits. In 8 bits, −5 is 1111 1011: flip every bit of 0000 0101 and add 1.

How we tested

156 gave 1001 1100, hex 9C and octal 234, with eight division steps. We also checked 0, 255 (1111 1111, FF), −5 (8-bit two's complement 1111 1011, plus 16, 32 and 64 bits), 10.625 (1010.101, marked exact), 0.1 (0.000110011… cut at 24 places), a 30-digit number and the invalid input "12a". In the binary box, 1001 1100 gave 156, 9C and 2^7 + 2^4 + 2^3 + 2^2. We ran the page in Chromium at desktop width and at 375 px: no sideways scrolling and no console errors. Not tested yet: Safari on iPhone and Firefox.

Questions

What is 10 in binary?

1010. Dividing by 2 gives remainders 0, 1, 0, 1; read from the last to the first, that is 1010 (8 + 2).

How do you write 255 in binary?

1111 1111, eight ones. It is the largest number that fits in one byte, which is why 255 appears so often in computing.

Can this convert decimal fractions?

Yes. Type a number like 10.625 and the converter adds the binary digits after the point (1010.101) and shows the multiply-by-2 steps. Many fractions, such as 0.1, never end in binary, so the result is cut after 24 places and marked with …

Is there a limit to how big the number can be?

The converter uses exact whole-number arithmetic, so very long numbers work. The step table stops after 64 divisions to keep the page readable.