Converting Hexadecimal to Decimal

Learn how to convert hexadecimal numbers to decimal step by step. Understand positional notation in base 16 with practical examples and conversion methods.

Conversion

Hex

FF = 255, 1A = 26, 7F = 127

ASCII

Base-16 → Base-10

Detailed Explanation

Converting hexadecimal (base 16) to decimal (base 10) is a fundamental skill for any developer working with low-level data, memory addresses, color codes, or binary protocols. The process involves multiplying each hex digit by the corresponding power of 16 and summing the results.

The hex digit set:

Hexadecimal uses 16 digits: 0-9 represent values 0-9, and A-F (case-insensitive) represent values 10-15.

Hex Decimal Hex Decimal
0 0 8 8
1 1 9 9
2 2 A 10
3 3 B 11
4 4 C 12
5 5 D 13
6 6 E 14
7 7 F 15

Step-by-step conversion method:

To convert hex to decimal, multiply each digit by 16 raised to the power of its position (counting from 0, right to left), then add all the products.

Example — converting 1A3F to decimal:

  1. Position 3: 1 × 16³ = 1 × 4096 = 4096
  2. Position 2: A (10) × 16² = 10 × 256 = 2560
  3. Position 1: 3 × 16¹ = 3 × 16 = 48
  4. Position 0: F (15) × 16⁰ = 15 × 1 = 15
  5. Sum: 4096 + 2560 + 48 + 15 = 6719

Common hex values and their decimals:

  • FF = 255 (maximum value of a single byte)
  • 100 = 256 (one more than a byte can hold)
  • FFFF = 65,535 (maximum 16-bit unsigned value)
  • 7F = 127 (maximum signed byte value / highest standard ASCII)
  • 80 = 128 (minimum negative value in signed byte, or start of extended ASCII)
  • 7FFFFFFF = 2,147,483,647 (maximum 32-bit signed integer)

Powers of 16 to memorize:

  • 16⁰ = 1
  • 16¹ = 16
  • 16² = 256
  • 16³ = 4,096
  • 16⁴ = 65,536
  • 16⁵ = 1,048,576
  • 16⁶ = 16,777,216
  • 16⁷ = 268,435,456
  • 16⁸ = 4,294,967,296

Quick mental math trick:

For two-digit hex values, multiply the left digit by 16 and add the right digit. For example, 3C = 3 × 16 + 12 = 60. For single hex digits, the decimal value is obvious (0-9 are the same, A=10, B=11, C=12, D=13, E=14, F=15).

Why this matters in practice:

Memory addresses, network ports, file offsets, Unicode code points, and RGB color values are all commonly expressed in hexadecimal. Being able to quickly convert to decimal helps when reading debugger output, calculating buffer sizes, or verifying that protocol fields contain expected values.

Use Case

Hex-to-decimal conversion is used constantly when reading debugger memory dumps, calculating file offsets, interpreting network port numbers in packet captures, and converting RGB color channel values.

Try It — Hex Editor

Open full tool