Number Base Converter
Convert between binary, hex, decimal, and octal
Quick Reference
| Decimal | Binary | Hex | Octal | Use |
|---|---|---|---|---|
| 0 | 0000 | 0 | 0 | Zero/false |
| 1 | 0001 | 1 | 1 | One/true |
| 10 | 1010 | A | 12 | Newline (LF) |
| 127 | 1111111 | 7F | 177 | Max signed byte |
| 255 | 11111111 | FF | 377 | Max byte |
| 256 | 100000000 | 100 | 400 | 1 byte + 1 |
| 1024 | 10000000000 | 400 | 2000 | 1 KB |
| 65535 | 1111111111111111 | FFFF | 177777 | Max 16-bit |
Why Computers Use Binary
Computers use binary (base 2) because digital circuits have two stable states: on and off, high voltage and low voltage, 1 and 0. Every piece of data in a computer — text, images, video, programs — is ultimately stored and processed as sequences of ones and zeros. A single binary digit (bit) stores one of two values. Eight bits make a byte, which can represent 256 values (2^8) — enough for every ASCII character, or a single pixel's red, green, or blue channel.
Hexadecimal (base 16) exists as a shorthand for binary. Every hex digit maps to exactly 4 binary digits: F = 1111, A = 1010, 0 = 0000. This means a byte (8 bits) can be written as exactly 2 hex digits: 11111111 = FF, 10101010 = AA. Reading "FF" is much faster than reading "11111111," which is why programmers, network engineers, and web developers use hex for everything from color codes (#FF5733) to MAC addresses (AA:BB:CC:DD:EE:FF) to memory addresses.
Practical Uses
Web colors: #FF5733 is three hex bytes — FF red (255), 57 green (87), 33 blue (51). Subnet masks: 255.255.255.0 in binary is 11111111.11111111.11111111.00000000 — the boundary between network and host portions. File permissions in Unix: 755 is three octal digits — 7 (rwx for owner), 5 (r-x for group), 5 (r-x for others). Understanding number bases turns these from magic numbers into readable, meaningful values.
How do I read binary?
Each position is a power of 2, right to left: 1, 2, 4, 8, 16, 32, 64, 128. To read 10110: 16+4+2 = 22. To convert 42 to binary: 32+8+2 = 101010. With practice, common values become instant: 1111 = 15, 11111111 = 255, 10000000 = 128.