Passer au contenu principal

Convert hexadecimal to decimal and back: guide and table

Convert hexadecimal numbers to decimal, binary and octal. Understand base 16 with CSS and computing examples.

Published on January 13, 2026

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.

Understanding the conversion

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

Hex → Decimal: d = Σ(digit × 16^position) | Decimal → Hex: divide by 16, read remainders from bottom to top

📊 Conversion 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

💡 Practical examples

Example 1: decode a CSS color #3A7BD5

R = 0x3A = 3×16+10 = 58. G = 0x7B = 7×16+11 = 123. B = 0xD5 = 13×16+5 = 213. rgb(58, 123, 213) — a medium blue.

Example 2: convert 255 to hexadecimal

255 ÷ 16 = 15 remainder 15 (F). 15 ÷ 16 = 0 remainder 15 (F). Read from bottom to top: FF. 255 decimal = 0xFF.

Example 3: memory address 0x7FFF0000

0x7FFF0000 = 7×16⁷ + F×16⁶ + F×16⁵ + F×16⁴ + 0×... = 2,147,418,112 in decimal. 64-bit memory addresses are far more readable in hex than decimal.

⚡ Use the tool

Try our free online tool — no installation required.

Open the tool →

🔗 Other useful tools

Lien copié !