Hexadecimal Converter
Hexadecimal (base-16) is everywhere in computing — memory addresses, color codes, character encodings, and cryptographic hashes all use hex because one hex digit represents exactly 4 binary bits, making it the most compact human-readable format for binary data.
Notes
The 16 Hex Digits and Their Values
Hex uses digits 0–9 plus six letters A–F. The letters represent the values 10–15 that have no single-character decimal equivalent. This is why one hex digit can represent exactly 16 values (0–15), matching a 4-bit binary number.
| Hex | Decimal | 4-bit Binary | Hex | Decimal | 4-bit Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | A | 10 | 1010 |
| 3 | 3 | 0011 | B | 11 | 1011 |
| 4 | 4 | 0100 | C | 12 | 1100 |
| 5 | 5 | 0101 | D | 13 | 1101 |
| 6 | 6 | 0110 | E | 14 | 1110 |
| 7 | 7 | 0111 | F | 15 | 1111 |
Hex → Decimal: Positional Notation
Replace each hex letter with its numeric value (A=10, B=11…F=15), then multiply each digit by 16 raised to its positional power and sum the results.
Hex → Binary: Direct 4-Bit Substitution
Replace each hex digit with its 4-bit binary equivalent from the table above. This is the fastest conversion — no arithmetic at all.
Hex → Octal: Via Binary
Expand each hex digit to 4 binary bits, concatenate all bits, regroup into 3-bit chunks from right to left, then map each chunk to its octal digit.
Real-World Examples of Hexadecimal
| Use case | Hex value | Meaning |
|---|---|---|
| Web color | #FF5733 | Red=255, Green=87, Blue=51 |
| ASCII 'A' | 0x41 | Decimal 65 → binary 01000001 |
| Max 1 byte | 0xFF | Decimal 255 → all 8 bits set |
| SHA-256 start | 0x6a09e667 | Part of first hash constant |
| IPv4 loopback | 0x7F000001 | 127.0.0.1 in hex |
- How Hex Conversion Works — Detailed Notes — Three worked examples, practical applications
- Hex Conversion Formula Reference — Positional notation formula with A–F digit values
Frequently Asked Questions
Are hex digits A–F case-sensitive?
No. A and a represent the same value (10). Uppercase is conventional for hardware, memory dumps, and assembly; lowercase is common in CSS colors and cryptographic hashes. This converter accepts both and outputs uppercase.
How do I decode a web color code like #3498DB?
Split into three 2-digit pairs: R=34, G=98, B=DB. Convert each pair: 34₁₆ = 52₁₀, 98₁₆ = 152₁₀, DB₁₆ = 219₁₀. So the color is RGB(52, 152, 219) — a medium blue.
Why does a byte always need exactly two hex digits?
One byte = 8 bits = two groups of 4 bits. Since one hex digit = 4 bits, one byte = exactly two hex digits. This is why memory sizes, color codes, and ASCII values are always shown as 2-digit hex pairs (00 through FF).
What does 0x mean before a hex number?
0x is the standard programming prefix indicating a hexadecimal literal. For example, 0xFF means the hex value FF = decimal 255. Other notations include a trailing 'h' (FFh) or a subscript 16 (FF₁₆).