Hex to Decimal Converter

This hex to decimal converter transforms hexadecimal (base-16) numbers into decimal (base-10) representation. Each hex digit is multiplied by its positional power of 16 and summed. Enter any hex value to see its decimal equivalent with a step-by-step positional notation breakdown.

Hex to Decimal Converter

Convert between hexadecimal and decimal number systems

Frequently Asked Questions

How do you convert hex to decimal?

Multiply each hex digit by its positional power of 16, then sum the results. Write out the hex number, assign powers of 16 from right to left starting at 16^0, convert any letters A-F to their decimal values (A=10, B=11, C=12, D=13, E=14, F=15), multiply each digit by its power of 16, and add all the products together. For example, hex 2F = 2×16¹ + 15×16⁰ = 32 + 15 = 47.

What is hexadecimal?

Hexadecimal (hex) is a base-16 number system that uses sixteen symbols: digits 0-9 for values zero through nine, and letters A-F for values ten through fifteen. It is widely used in computing because each hex digit represents exactly 4 binary bits, making it a compact and human-readable way to represent binary data. Two hex digits represent one byte (8 bits), so a byte value like 11111111 in binary can be written simply as FF in hex.

What is the hex to decimal formula?

The hex to decimal formula is: decimal = d(n)×16^n + d(n-1)×16^(n-1) + ... + d(1)×16^1 + d(0)×16^0, where d(i) is the decimal value of the hex digit at position i (counting from the right starting at 0). Each hex digit A-F is replaced with its decimal equivalent (A=10 through F=15) before multiplying by the corresponding power of 16.

How do you convert hex to decimal quickly?

For small hex values, memorize that each hex digit position is worth 1, 16, 256, 4096, and so on. For a two-digit hex number like 'AB', calculate: A(10)×16 + B(11) = 160 + 11 = 171. For single hex digits 0-F, the decimal value is simply the digit itself (0-9) or the letter's value (A=10 through F=15). For larger values, use our free hex to decimal converter for instant results.

What is 0xFF in decimal?

0xFF in decimal is 255. The 0x prefix indicates a hexadecimal number. F in hex equals 15 in decimal, so FF = 15×16 + 15 = 240 + 15 = 255. This is the maximum value of an unsigned 8-bit byte (all 8 bits set to 1 in binary: 11111111). 0xFF is commonly used in programming as a bitmask to isolate a single byte from a larger value.

How do you convert signed hex to decimal?

For signed hexadecimal (two's complement), check if the most significant bit is set. For an 8-bit value, if the hex is 80-FF, the number is negative. To find the negative value: invert all bits and add 1. For example, hex FF as a signed 8-bit integer: FF = 11111111 in binary, invert to get 00000000, add 1 to get 00000001 = 1, so the result is -1. Hex 7F (01111111) is the maximum positive signed byte value: 127.

What is the difference between hex and decimal?

Hexadecimal is base-16 (using digits 0-9 and letters A-F) while decimal is base-10 (using only digits 0-9). Hex is preferred in computing because it aligns perfectly with binary: each hex digit represents exactly 4 bits. This makes hex a compact notation for binary data — the byte value 11010110 in binary is D6 in hex but 214 in decimal. Decimal is the standard human number system used in everyday mathematics.

Where is hexadecimal used in computing?

Hexadecimal is used extensively in computing: color codes in web design (#FF5733), memory addresses in debugging (0x7FFF5FBFF8AC), MAC addresses in networking (00:1A:2B:3C:4D:5E), Unicode character codes (U+0041 for the letter A), cryptographic hashes (SHA-256 produces 64 hex digits), assembly language programming, and IPv6 addresses. It is preferred because two hex digits represent exactly one byte.

How do you convert hex to decimal in Python?

In Python, use the built-in int() function with base 16: int('FF', 16) returns 255. You can also use the 0x prefix for hex literals: 0xFF evaluates to 255. For the reverse (decimal to hex), use hex(255) which returns '0xff', or format(255, 'X') for uppercase without the prefix: 'FF'.

What does the 0x prefix mean?

The 0x prefix is a notation convention used in programming languages like C, Java, Python, and JavaScript to indicate that a number is hexadecimal (base-16). For example, 0xFF means the hex value FF (decimal 255), not the string 'FF'. Other common hex notations include # for CSS color codes (#FF5733), $ in some assembly languages, and h suffix in Intel assembly (FFh). The prefix does not change the value — it only tells the parser to interpret the digits as hexadecimal.

How to Convert Hex to Decimal

Converting hexadecimal to decimal uses positional notation — the same principle behind how decimal numbers work, but with base 16 instead of base 10. Each digit in a hex number has a positional value that is a power of 16, and the decimal result is the sum of all digit values multiplied by their positional weights.

The Positional Notation Formula

The general formula for converting a hex number with nn digits to decimal is:

D=dn1×16n1+dn2×16n2++d1×161+d0×160D = d_{n-1} \times 16^{n-1} + d_{n-2} \times 16^{n-2} + \cdots + d_1 \times 16^1 + d_0 \times 16^0

Where did_i is the decimal value of the hex digit at position ii (counting from the right, starting at 0). Hex letters map to: A=10, B=11, C=12, D=13, E=14, F=15.

Step-by-Step Conversion Method

Follow these steps to convert any hexadecimal number to decimal by hand:

Step 1: Write down the hex number

Remove any prefix such as 0x or #. For example, 0x1A3F becomes 1A3F.

Step 2: Assign powers of 16 to each digit from right to left

The rightmost digit gets 160 = 1, the next gets 161 = 16, then 162 = 256, 163 = 4,096, and so on.

Step 3: Convert hex letters (A-F) to their decimal values

Replace A with 10, B with 11, C with 12, D with 13, E with 14, and F with 15. Digits 0-9 remain unchanged.

Step 4: Multiply each digit by its power of 16

Calculate the product of each digit's decimal value and its corresponding power of 16.

Step 5: Sum all products

Add all the products together. The result is the decimal equivalent of the hexadecimal number.

Powers of 16 Reference

Memorizing the first few powers of 16 makes hex-to-decimal conversion much faster:

PowerValueMeaning
1601Ones place
16116Sixteens place
162256Two-fifty-sixes place
1634,096Four-thousand-ninety-sixes place
16465,53616-bit boundary
1684,294,967,29632-bit boundary

Hex to Decimal Conversion Table

This complete hex to decimal conversion table covers all 256 byte values from 00 to FF. Each row shows the hexadecimal value, its decimal equivalent, binary representation, and octal equivalent.

Quick Reference (Single Hex Digits 0-F):

HexDecimalBinaryOctal
00000000000000
01100000001001
02200000010002
03300000011003
04400000100004
05500000101005
06600000110006
07700000111007
08800001000010
09900001001011
0A1000001010012
0B1100001011013
0C1200001100014
0D1300001101015
0E1400001110016
0F1500001111017

This table covers all possible single-byte hexadecimal values (00-FF) with their decimal, 8-bit binary, and octal equivalents. For values beyond FF, apply the same positional notation formula to each hex digit.

Hex to Decimal Conversion Examples

Below are worked examples showing the hex to decimal conversion process step by step, from simple single-digit values to multi-byte numbers.

Convert 2F to Decimal

Hex input: 2F

1. 2×161=2×16=322 \times 16^1 = 2 \times 16 = 32

2. F(15)×160=15×1=15F(15) \times 16^0 = 15 \times 1 = 15

3. 32+15=4732 + 15 = 47

Result: 2F16 = 4710

Convert FF to Decimal

Hex input: FF

1. F(15)×161=15×16=240F(15) \times 16^1 = 15 \times 16 = 240

2. F(15)×160=15×1=15F(15) \times 16^0 = 15 \times 1 = 15

3. 240+15=255240 + 15 = 255

Result: FF16 = 25510 — the maximum value of an unsigned byte.

Convert 1A3F to Decimal

Hex input: 1A3F

1. 1×163=1×4096=40961 \times 16^3 = 1 \times 4096 = 4096

2. A(10)×162=10×256=2560A(10) \times 16^2 = 10 \times 256 = 2560

3. 3×161=3×16=483 \times 16^1 = 3 \times 16 = 48

4. F(15)×160=15×1=15F(15) \times 16^0 = 15 \times 1 = 15

5. 4096+2560+48+15=67194096 + 2560 + 48 + 15 = 6719

Result: 1A3F16 = 6,71910

Convert DEADBEEF to Decimal

Hex input: DEADBEEF (a famous "hexspeak" debug marker)

1. D(13)×167=13×268435456=3,489,660,928D(13) \times 16^7 = 13 \times 268435456 = 3{,}489{,}660{,}928

2. E(14)×166=14×16777216=234,881,024E(14) \times 16^6 = 14 \times 16777216 = 234{,}881{,}024

3. A(10)×165=10×1048576=10,485,760A(10) \times 16^5 = 10 \times 1048576 = 10{,}485{,}760

4. D(13)×164=13×65536=851,968D(13) \times 16^4 = 13 \times 65536 = 851{,}968

5. B(11)×163=11×4096=45,056B(11) \times 16^3 = 11 \times 4096 = 45{,}056

6. E(14)×162=14×256=3,584E(14) \times 16^2 = 14 \times 256 = 3{,}584

7. E(14)×161=14×16=224E(14) \times 16^1 = 14 \times 16 = 224

8. F(15)×160=15×1=15F(15) \times 16^0 = 15 \times 1 = 15

Result: DEADBEEF16 = 3,735,928,55910 — a 32-bit value commonly used to mark uninitialized memory.

Convert Color Code #3A7BD5 to Decimal

Hex input: #3A7BD5 (a shade of blue)

Full value: 3A7BD516=3,833,813103A7BD5_{16} = 3{,}833{,}813_{10}

Per channel (each pair is one byte):

Red: 3A16=3×16+10=583A_{16} = 3 \times 16 + 10 = 58

Green: 7B16=7×16+11=1237B_{16} = 7 \times 16 + 11 = 123

Blue: D516=13×16+5=213D5_{16} = 13 \times 16 + 5 = 213

RGB result: (58, 123, 213). You can also convert hex color codes using our hex to RGB converter.

Hex to Decimal in Programming

Most programming languages provide built-in functions for converting hexadecimal strings to decimal integers. Here are examples in popular languages.

Python

# Convert hex string to decimal integer
hex_value = "FF"
decimal_value = int(hex_value, 16)
print(decimal_value)          # 255

# Using 0x prefix literal
value = 0xFF
print(value)                  # 255

# Decimal to hex (reverse)
print(hex(255))               # '0xff'
print(format(255, 'X'))       # 'FF'

# Large hex values
big_hex = "DEADBEEF"
big_decimal = int(big_hex, 16)
print(big_decimal)            # 3735928559

JavaScript

// Convert hex string to decimal number
const hexValue = "FF";
const decimalValue = parseInt(hexValue, 16);
console.log(decimalValue);    // 255

// Using 0x prefix literal
const value = 0xFF;
console.log(value);           // 255

// Decimal to hex (reverse)
console.log((255).toString(16).toUpperCase()); // 'FF'

// For values larger than 2^53, use BigInt
const bigHex = "DEADBEEFDEADBEEF";
const bigDec = BigInt("0x" + bigHex);
console.log(bigDec.toString()); // '16045690984833335023'

C

#include <stdio.h>
#include <stdlib.h>

int main() {
    // Convert hex string to decimal using strtol
    const char *hexStr = "FF";
    long decimal = strtol(hexStr, NULL, 16);
    printf("%ld\n", decimal);  // 255

    // Using hex literal
    int value = 0xFF;
    printf("%d\n", value);     // 255

    // Larger value
    unsigned long big = strtoul("DEADBEEF", NULL, 16);
    printf("%lu\n", big);      // 3735928559

    return 0;
}

Applications of Hex to Decimal Conversion

  • Memory addresses — Debugging tools display memory addresses in hex (e.g., 0x7FFF5FBFF8AC). Converting to decimal helps with offset calculations and pointer arithmetic.
  • Web color codes — CSS hex colors like #FF5733 encode RGB channel values as decimal 0-255. Converting hex pairs to decimal reveals the actual color intensity: FF = 255 (max red), 57 = 87 (moderate green), 33 = 51 (low blue).
  • MAC addresses — Network interface identifiers (00:1A:2B:3C:4D:5E) use hex notation. Converting to decimal is needed for certain network administration tasks and database queries.
  • Unicode code points — Characters are identified by hex code points (e.g., U+0041 for the letter "A"). Converting U+0041 to decimal gives 65, which is the ASCII value.
  • Cryptographic hashes — Hash values like SHA-256 are displayed in hex. Converting individual bytes to decimal is useful for checksum verification and statistical analysis.

Related Converters

Explore our other number system and encoding converters for related tasks:

For a deep dive into how hexadecimal works and its role in computing, read our comprehensive guide: How Does Hexadecimal Work: Complete Guide to Base-16 Numbers.