Decimal to Binary Converter

Convert a decimal number to binary by dividing by 2 again and again, with every division shown, and see it in octal and hex too.

In binary

10011100₂

156₁₀ = 10011100₂.

Binary
10011100
Octal
234
Decimal
156
Hex
9C

Show me how

All steps as text

    Tip: press ← and → to move between steps, or click any step.

    How to convert decimal to binary

    Divide by 2 again and again, writing down each remainder, until the answer is 0. The remainders, read from the bottom up, are the binary digits. For 156:

    1. 156 ÷ 2 = 78, remainder 0
    2. 78 ÷ 2 = 39, remainder 0
    3. 39 ÷ 2 = 19, remainder 1
    4. 19 ÷ 2 = 9, remainder 1
    5. 9 ÷ 2 = 4, remainder 1
    6. 4 ÷ 2 = 2, remainder 0
    7. 2 ÷ 2 = 1, remainder 0
    8. 1 ÷ 2 = 0, remainder 1

    Reading the remainders upwards gives 10011100, so 156 in binary is 10011100. Each division by 2 splits off the last binary digit, which is why the first remainder ends up last.

    Another way: take away powers of 2

    Find the biggest power of 2 that fits, take it away, and repeat. For 156: 128 fits, leaving 28; 16 fits, leaving 12; 8 fits, leaving 4; 4 fits, leaving 0. Write a 1 under 128, 16, 8 and 4 and a 0 under the other places:

    1286432168421
    10011100

    0 to 16 in binary

    DecimalBinaryDecimalBinary
    0091001
    11101010
    210111011
    311121100
    4100131101
    5101141110
    6110151111
    71111610000
    8100025511111111

    Bits and bytes

    Each binary digit is a bit. A byte is 8 bits, from 00000000 (0) to 11111111 (255), which is why so many computer settings stop at 255. 16 bits go up to 65,535, and 32 bits up to 4,294,967,295.

    Questions

    What is 10 in binary?

    1010. 10 = 8 + 2, so there are 1s in the 8 and 2 places and 0s in the 4 and 1 places.

    How do computers write negative numbers in binary?

    Usually with two’s complement: write the positive number, flip every bit, and add 1. In 8 bits, 5 is 00000101, so −5 is 11111010 + 1 = 11111011. This converter works with whole numbers from 0 up.

    How do I convert a decimal fraction like 0.625 to binary?

    Multiply by 2 again and again and keep the whole-number parts: 0.625 × 2 = 1.25 (1), 0.25 × 2 = 0.5 (0), 0.5 × 2 = 1 (1). So 0.625 = 0.101 in binary. This converter handles whole numbers.

    Why do computers use binary?

    A computer stores everything with tiny switches that are either off or on. Two states fit two digits, 0 and 1, so binary is the natural way for a machine to count.