Hexadecimal notation (base 16) is ubiquitous in computing: CSS color codes (#FF5733), memory addresses, register values, MD5/SHA hashes and network protocols. Knowing how to convert between hexadecimal and decimal is an essential skill for developers and IT professionals.
Base 16 uses digits 0–9 and letters A–F (A=10, B=11, C=12, D=13, E=14, F=15). Each hexadecimal digit represents 4 bits (a half-byte, called a nibble). Two hex digits therefore represent a complete byte (0–255 in decimal). To convert hex → decimal, multiply each digit by the corresponding power of 16 at its position. For decimal → hex, repeatedly divide by 16 and read remainders upward.
📐 Formula
📊 Reference table
| Hexadecimal | Decimal | Binary | Common use |
|---|---|---|---|
| 0x00 | 0 | 00000000 | Null value |
| 0x0F | 15 | 00001111 | Max low nibble |
| 0xFF | 255 | 11111111 | Max byte, CSS opacity |
| 0x1F4 | 500 | 111110100 | Generic value |
| 0xFFFF | 65,535 | 16 bits all 1 | Max network port |
| #FFFFFF | R:255 G:255 B:255 | — | White in CSS |
| #FF0000 | R:255 G:0 B:0 | — | Red in CSS |