Decimal to Binary Converter

Convert decimal to binary with every step shown as a repeated division by 2. Group the bits in fours or bytes, convert huge numbers exactly and get the two's complement bits of negative numbers.

Whole numbers of any size. Commas and spaces are ignored, and a minus sign is allowed.

Binary number

The same number in every base
Binary
Octal
Decimal
Hex
Bit length
Show steps

Divide the decimal number by the new base again and again until the quotient is 0. The remainders, read from the bottom up, are the digits of the result.

DivisionQuotientRemainderDigit

Two's complement view (signed numbers)

Auto picks the smallest of 8, 16, 32 or 64 bits that holds the number as a signed value.

Width
Bits
Hex
Unsigned
Signed

Convert Decimal Numbers to Binary Online

Whether you are studying for an exam, setting a bit mask or writing a byte to hardware, you often need a number in binary. This decimal to binary converter writes any whole number in base 2 as you type it.

The steps table shows the repeated division by 2 for your exact number, so you can follow the method line by line.

Decimal number converted to binary15610011100Decimal toBinary

How to use the decimal to binary converter

  1. Type a decimal number, for example 156.
  2. Copy the binary result, 10011100. Pick "Groups of 4 bits" to get 1001 1100.
  3. Follow the steps to see each division, or open the two's complement view for a fixed width such as 8 or 16 bits.

How to convert decimal to binary: divide by 2

Divide the number by 2 and write down the remainder, which is always 0 or 1. Divide the quotient by 2 again and repeat until the quotient is 0. The remainders read from the bottom up are the binary digits. For 156:

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

Reading the remainders upward gives 10011100. Check it: 128 + 16 + 8 + 4 = 156.

The subtraction method

For smaller numbers it can be quicker to subtract powers of 2. Find the largest power of 2 that fits, subtract it and repeat. For 100: 64 fits (36 left), then 32 (4 left), then 4 (0 left). Put a 1 under 64, 32 and 4 and a 0 under every other place value: 1100100.

Decimal to binary table (0–16)

DecimalBinary4-bit / 8-bit form
000000
110001
2100010
3110011
41000100
51010101
61100110
71110111
810001000
910011001
1010101010
1110111011
1211001100
1311011101
1411101110
1511111111
16100000001 0000

More decimal to binary examples

DecimalBinaryBits
421010106
9911000117
12711111117
200110010008
5000001 1111 01009
1,0230011 1111 111110
4,0960001 0000 0000 000013

Negative numbers in binary

With a minus sign, the converter writes the magnitude in binary and keeps the sign, so −13 becomes -1101. Computers instead use two's complement: write 13 in the chosen width (00001101), flip every bit (11110010) and add 1 to get 11110011. The two's complement view does this for 8, 16, 32 or 64 bits.

A width of n bits holds signed values from −2n−1 to 2n−1 − 1, so 8 bits cover −128 to 127.

How many bits does a number need?

n bits store unsigned values from 0 to 2n − 1: 4 bits reach 15, 8 bits 255, 16 bits 65,535 and 32 bits 4,294,967,295.

Only whole numbers are supported. Fractions such as 0.1 have no exact binary form (they repeat forever), which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.

Frequently Asked Questions

Common questions about converting decimal numbers to binary.

Divide by 2 repeatedly and write down the remainders, then read them from the last to the first. 13 gives remainders 1, 0, 1, 1, so 13 is 1101 in binary.

10 is 1010 in binary: 8 + 2.

255 is 11111111, eight 1s. It is the largest value of one byte.

100 is 1100100, which is 64 + 32 + 4.

In two's complement every bit is 1: 11111111 in 8 bits, or sixteen 1s in 16 bits. With a plain minus sign it is -1.

Groups of 4 are easier to read and each group is exactly one hex digit, so 1001 1100 is 9C in hex.

Use the binary to decimal converter, which adds up the powers of 2 for you.