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
The same number in each base
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
| 65535 | 1111111111111111 | 177777 | FFFF |
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