5 min read
2026-02-10
Knowing powers of 2 speeds up translations: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. This is a basic programmer skill.
Every 4 binary digits = 1 hexadecimal. 1010 1111 = AF. This allows you to translate long binary numbers piece by piece.
Group the bits by 3: 101 111 = 57 in octal. Handy for Unix permissions.
`0b1010` - binary in most languages
`0o12` - octal
`0xFF` - hexadecimal
Maximum for 8 bits: 255 (0xFF), for 16 bits: 65535 (0xFFFF), for 32 bits: 4294967295 (0xFFFFFFFF). Knowing these boundaries helps with debugging.
| Bit depth | Maximum (DEC) | Maximum (HEX) |
|---|---|---|
| 8 bit | 255 | FF |
| 16 bit | 65 535 | FFFF |
| 32 bit | 4 294 967 295 | FFFFFFFF |
See also: Color converter, Data converter