Hex to Decimal Converter - Free Online Tool with Formula & Examples

Convert hexadecimal numbers to decimal instantly with our professional online hex to decimal converter. Includes conversion formula, tables, programming examples in Python, JavaScript, C, and Excel methods.

Perfect for programmers, students, and professionals working with binary data, memory addresses, color codes, and number system conversions. Supports 0x prefix, large numbers, and provides step-by-step calculations.

Hex to Decimal Conversion Formula

Mathematical Formula

Decimal = Σ (digit × 16^position)

Where each hexadecimal digit is multiplied by 16 raised to its position power (starting from 0 on the right), and all results are summed together.

Step-by-Step Example: 1A3F

Position: 3 2 1 0
Digit: 1 A 3 F
Value: 1 10 3 15
1×16³ = 1×4096 = 4096
A×16² = 10×256 = 2560
3×16¹ = 3×16 = 48
F×16⁰ = 15×1 = 15
Total: 4096+2560+48+15 = 6719

Quick Reference: Hex Digits

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

Hex to Decimal Conversion Table

Single Hex Digits (0-F)

HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Common Multi-Digit Values

HexDecimalDescription
101616
FF255255
100256256
3FF1,0231023
FFF4,0954095
FFFF65,53565535
1000065,53665536
FFFFF1,048,5751048575
FFFFFF16,777,21516777215
FFFFFFFF4,294,967,2954294967295

Hex to Decimal in Programming Languages

🐍Python - Hex to Decimal

# Method 1: Using int() function
hex_string = "1A3F"
decimal = int(hex_string, 16)
print(decimal)  # Output: 6719

# Method 2: Using 0x prefix
decimal = int("0x1A3F", 16)
print(decimal)  # Output: 6719

# Method 3: Manual calculation
def hex_to_decimal(hex_str):
    decimal = 0
    for i, digit in enumerate(hex_str[::-1]):
        if digit.isdigit():
            decimal += int(digit) * (16 ** i)
        else:
            decimal += (ord(digit.upper()) - ord('A') + 10) * (16 ** i)
    return decimal

print(hex_to_decimal("1A3F"))  # Output: 6719

JavaScript - Hex to Decimal

// Method 1: Using parseInt()
const hexString = "1A3F";
const decimal = parseInt(hexString, 16);
console.log(decimal); // Output: 6719

// Method 2: Using Number() with 0x prefix
const decimal2 = Number("0x1A3F");
console.log(decimal2); // Output: 6719

// Method 3: Manual function
function hexToDecimal(hex) {
    let decimal = 0;
    for (let i = 0; i < hex.length; i++) {
        const digit = hex[hex.length - 1 - i];
        const value = isNaN(digit) ? 
            digit.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 10 : 
            parseInt(digit);
        decimal += value * Math.pow(16, i);
    }
    return decimal;
}

console.log(hexToDecimal("1A3F")); // Output: 6719

⚙️C - Hex to Decimal

#include <stdio.h>
#include <string.h>
#include <math.h>

// Method 1: Using sscanf()
int main() {
    char hex[] = "1A3F";
    unsigned int decimal;
    sscanf(hex, "%x", &decimal);
    printf("Decimal: %u\n", decimal); // Output: 6719
    return 0;
}

// Method 2: Manual conversion
int hexToDecimal(char hex[]) {
    int len = strlen(hex);
    int decimal = 0;
    int power = 0;
    
    for (int i = len - 1; i >= 0; i--) {
        int digit;
        if (hex[i] >= '0' && hex[i] <= '9') {
            digit = hex[i] - '0';
        } else if (hex[i] >= 'A' && hex[i] <= 'F') {
            digit = hex[i] - 'A' + 10;
        } else if (hex[i] >= 'a' && hex[i] <= 'f') {
            digit = hex[i] - 'a' + 10;
        }
        decimal += digit * pow(16, power++);
    }
    return decimal;
}

📊Excel - Hex to Decimal

Built-in Function:

=HEX2DEC("1A3F")

Result: 6719

Manual Formula:

=SUMPRODUCT(--("0123456789ABCDEF"&""),MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+1)*16^(LEN(A1)-ROW(INDIRECT("1:"&LEN(A1)))))

Note: Excel's HEX2DEC function supports up to 10 characters (40 bits). For larger numbers, use programming languages.

Advanced Hex to Decimal Concepts

Little Endian vs Big Endian

Hex: 0x12345678

Big Endian: 12 34 56 78 → 305,419,896
Little Endian: 78 56 34 12 → 2,018,915,346

Endianness affects how multi-byte hex values are interpreted in memory. Most x86 systems use little-endian format.

Hex Color Codes

#FF0000 → R:255, G:0, B:0
#00FF00 → R:0, G:255, B:0
#0000FF → R:0, G:0, B:255

Each pair of hex digits represents RGB color intensity (0-255).

Hex IP Addresses

IPv4: 192.168.1.1
Hex: 0xC0A80101
Decimal: 3,232,235,777
C0 (192) | A8 (168) | 01 (1) | 01 (1)

Memory Addresses

32-bit: 0x7FFFFFFF → 2,147,483,647
64-bit: 0x7FFFFFFFFFFFFFFF
→ 9,223,372,036,854,775,807

Memory addresses are typically displayed in hexadecimal for easier reading and debugging.

Common Hex Patterns

0xDEADBEEF → 3,735,928,559 (Debug marker)
0xCAFEBABE → 3,405,691,582 (Java class files)
0xFEEDFACE → 4,277,009,102 (Mach-O files)

Embed This Hexadecimal Converter

Integrate this professional hex to decimal converter into your website, documentation, or educational platform:

<iframe 
  src="https://rgbatohex.com/tools/hex-to-decimal-converter?embed=true" 
  width="100%" 
  height="500" 
  style="border:none;border-radius:12px;overflow:hidden;" 
  title="Hexadecimal to Decimal Converter"
></iframe>

Frequently Asked Questions

How do you convert hex to decimal manually?

To convert hex to decimal manually, multiply each digit by 16 raised to its position power (starting from 0 on the right) and sum all results. For example, 1A3F = 1×16³ + 10×16² + 3×16¹ + 15×16⁰ = 4096 + 2560 + 48 + 15 = 6719.

What's the difference between hex color codes and regular hex numbers?

Hex color codes are simply hexadecimal numbers representing RGB values. A 6-digit hex color like #FF5733 contains three 2-digit hex numbers: FF (red=255), 57 (green=87), and 33 (blue=51). The conversion principle is identical.

Why do programmers use hexadecimal?

Hexadecimal is preferred because it directly maps to binary (4 bits = 1 hex digit), making it easier to represent memory addresses, byte values, and bit patterns. It's more compact than binary and more readable than decimal for low-level programming.

How large hex numbers can this converter handle?

Our converter uses JavaScript's BigInt for numbers larger than 32 bits, supporting virtually unlimited precision. This makes it suitable for cryptographic hashes, large memory addresses, and scientific calculations requiring extreme precision.

What about negative hex numbers?

Hexadecimal representation of negative numbers depends on the system (two's complement in most cases). For example, in 32-bit two's complement, 0xFFFFFFFF represents -1. Our converter handles positive hex numbers; for negative numbers, consider the specific encoding used in your system.