Convert Hexadecimal to Decimal
Convert hexadecimal numbers to decimal with clear examples. Learn how hex digits A-F map to values 10-15 and how to calculate the decimal equivalent easily.
Detailed Explanation
Hexadecimal (base 16) uses digits 0-9 and letters A-F, where A=10, B=11, C=12, D=13, E=14, and F=15. Converting hex to decimal follows the same positional notation principle as binary, but using powers of 16 instead of 2.
Step-by-step example — converting 1A3F to decimal:
- Write each digit with its position (right to left):
1(3) A(2) 3(1) F(0) - Replace letters with values:
1(3) 10(2) 3(1) 15(0) - Multiply by powers of 16:
1×16³ + 10×16² + 3×16¹ + 15×16⁰ - Calculate:
4096 + 2560 + 48 + 15 = 6719
So 0x1A3F = 6719₁₀.
Why hexadecimal is important:
Hex is widely used in computing because it provides a compact representation of binary data. Each hex digit maps to exactly 4 binary bits, making conversion between hex and binary trivial. A single byte (8 bits) is always exactly 2 hex digits, which is far easier to read than 8 binary digits.
Common hex values you should recognize:
0xFF = 255— maximum value of a single byte0x100 = 256— one more than a byte can hold0xFFFF = 65535— maximum 16-bit unsigned value0x7FFFFFFF = 2147483647— maximum 32-bit signed integer0xDEADBEEF = 3735928559— classic magic number used in debugging
Programming shortcuts:
Most languages accept hex literals directly. In JavaScript, 0x1A3F evaluates to 6719. In Python, int("1A3F", 16) returns the same result. The 0x prefix is a universal convention indicating a hexadecimal number. Understanding hex-to-decimal conversion is essential for reading memory dumps, debugging binary protocols, and working with color codes.
Use Case
When analyzing memory dumps or crash reports, developers convert hex addresses like 0x7FFF5FBFF8A0 to decimal to calculate offsets and understand memory layout.
Try It — Number Base Converter
Related Topics
Convert Decimal to Hexadecimal
Decimal (Base 10) → Hexadecimal (Base 16)
Convert Hexadecimal to Binary
Hexadecimal (Base 16) → Binary (Base 2)
Understanding Hex Color Codes in CSS and Design
Visual Color → Hexadecimal (Base 16)
How to Read a Hexdump
Raw Binary Data → Hexadecimal + ASCII
Convert Hex Color Codes to RGB
Hexadecimal (Base 16) → RGB (Decimal Triplet)