Developer Bases

Decimal to binary

Decimal value
Binary 10101010
Divide by two, keep the remainders
The same number elsewhere
Decimal 170
Binary, grouped 1010 1010
Octal 252
Hexadecimal AA
Bits needed 8
Note
Grouped into nibbles · four bits per hex digit
DecimalBinaryOctalHex
0000
1111
81000108
10101012A
15111117F
16100002010
64100000010040
100110010014464
25511111111377FF
256100000000400100
1024100000000002000400
655351111111111111111177777FFFF
Advertisement
320 × 100

Divide repeatedly by two and read the remainders backwards. 170 gives 10101010. Alternatively subtract the largest power of two that fits and repeat: 170 − 128 − 32 − 8 − 2 = 0.

How to convert decimal to binary

1 Enter the decimal number.
2 Read the binary, both run together and grouped into nibbles.
3 Check the bits row to see how many bits it needs.
4 Use the grouped form when writing it down — it is far easier to check.

The subtraction method is faster by hand than repeated division. Write down the powers of two above your number, then work down: does 128 fit in 170? Yes, so write 1 and subtract, leaving 42. Does 64 fit in 42? No, write 0. Does 32? Yes, and so on. It produces the digits left to right in one pass rather than in reverse.

Questions

1010.

Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING