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.
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.
Hex | Decimal | Binary |
---|---|---|
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
3 | 3 | 0011 |
4 | 4 | 0100 |
5 | 5 | 0101 |
6 | 6 | 0110 |
7 | 7 | 0111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
A | 10 | 1010 |
B | 11 | 1011 |
C | 12 | 1100 |
D | 13 | 1101 |
E | 14 | 1110 |
F | 15 | 1111 |
Hex | Decimal | Description |
---|---|---|
10 | 16 | 16 |
FF | 255 | 255 |
100 | 256 | 256 |
3FF | 1,023 | 1023 |
FFF | 4,095 | 4095 |
FFFF | 65,535 | 65535 |
10000 | 65,536 | 65536 |
FFFFF | 1,048,575 | 1048575 |
FFFFFF | 16,777,215 | 16777215 |
FFFFFFFF | 4,294,967,295 | 4294967295 |
# 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
// 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
#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;
}
=HEX2DEC("1A3F")
Result: 6719
=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.
Endianness affects how multi-byte hex values are interpreted in memory. Most x86 systems use little-endian format.
#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).
Memory addresses are typically displayed in hexadecimal for easier reading and debugging.
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>
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.
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.
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.
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.
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.