Binary and Hex for Developers: The Numbers Your Computer Actually Uses
Understanding binary, hexadecimal, and base conversion is essential for debugging, low-level programming, and working with memory addresses.
Why Should Developers Care?
Even if you write high-level code, binary and hex show up everywhere: memory addresses in debugger output, color codes in CSS (#FF5733), UUIDs, network packets, cryptographic keys. Understanding these bases makes you a more effective debugger.
Binary (Base 2)
Computers use binary — 0s and 1s — because electrical signals have two states: off (0) and on (1). Each digit is called a bit. Eight bits make a byte.
Decimal to Binary:
13 = 8 + 4 + 1 = 1101
255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 11111111
Binary to Decimal:
1010 = 8 + 0 + 2 + 0 = 10
11111111 = 255
Hexadecimal (Base 16)
Hex is a compact way to represent binary. Each hex digit covers 4 binary digits (a nibble). This makes it human-readable while mapping directly to memory.
Hex to Binary:
0 = 0000 8 = 1000
1 = 0001 9 = 1001
2 = 0010 A = 1010
3 = 0011 B = 1011
4 = 0100 C = 1100
5 = 0101 D = 1101
6 = 0110 E = 1110
7 = 0111 F = 1111
# Examples
0xFF = 255 (11111111)
0x10 = 16 (00010000)
0xBAD = 2989 (101110101101)
Common Uses
- Colors in CSS:
#FF5733= RGB(255, 87, 51) - Memory addresses:
0x7fff5fbff8a0 - UUIDs:
550e8400-e29b-41d4-a716-446655440000 - Network addresses: IPv6 uses hex groups
Use Our Number Base Converter
Our Number Base Converter instantly converts between binary, octal, decimal, and hexadecimal — no mental math needed.
Quick Reference
Decimal Binary Hex
0 0000 0
15 1111 F
16 00010000 10
255 11111111 FF
1024 01000000 400