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
For a hex number with n digits, the formula is:
D = d(n-1) × 16^(n-1) + d(n-2) × 16^(n-2) + ⋯ + 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). Hex letters map to: A=10, B=11, C=12, D=13, E=14, F=15.
Step-by-Step Conversion Method
- Write down the hex number — Remove any prefix such as
0xor#. For example,0x1A3Fbecomes1A3F. - Assign powers of 16 from right to left — The rightmost digit gets 16⁰ = 1, the next 16¹ = 16, then 16² = 256, 16³ = 4,096, and so on.
- 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.
- Multiply each digit by its power of 16 — Calculate the product of each digit's decimal value and its corresponding power of 16.
- Sum all products — Add all the products together. The result is the decimal equivalent.
Powers of 16 Reference
| Power | Value | Meaning |
|---|---|---|
| 16⁰ | 1 | Ones place |
| 16¹ | 16 | Sixteens place |
| 16² | 256 | Two-fifty-sixes place |
| 16³ | 4,096 | Four-thousand-ninety-sixes place |
| 16⁴ | 65,536 | 16-bit boundary |
| 16⁸ | 4,294,967,296 | 32-bit boundary |
Hex to Decimal Conversion Table (00–FF)
This complete table covers all 256 byte values from 00 to FF. Each row shows the hexadecimal value, its decimal equivalent, 8-bit binary representation, and octal equivalent.
Quick Reference — Single Hex Digits 0–F:
| Hex | Decimal | Binary | Octal |
|---|---|---|---|
| 00 | 0 | 00000000 | 000 |
| 01 | 1 | 00000001 | 001 |
| 02 | 2 | 00000010 | 002 |
| 03 | 3 | 00000011 | 003 |
| 04 | 4 | 00000100 | 004 |
| 05 | 5 | 00000101 | 005 |
| 06 | 6 | 00000110 | 006 |
| 07 | 7 | 00000111 | 007 |
| 08 | 8 | 00001000 | 010 |
| 09 | 9 | 00001001 | 011 |
| 0A | 10 | 00001010 | 012 |
| 0B | 11 | 00001011 | 013 |
| 0C | 12 | 00001100 | 014 |
| 0D | 13 | 00001101 | 015 |
| 0E | 14 | 00001110 | 016 |
| 0F | 15 | 00001111 | 017 |
The full 00–FF table (256 entries) is available in the interactive converter above — use it to look up any byte value instantly.
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.
Convert 2F to Decimal
Hex: 2F
2 × 16¹ = 2 × 16 = 32
F (15) × 16⁰ = 15 × 1 = 15
32 + 15 = 47
Result: 2F₁₆ = 47₁₀
Convert FF to Decimal
Hex: FF
F (15) × 16¹ = 15 × 16 = 240
F (15) × 16⁰ = 15 × 1 = 15
240 + 15 = 255
Result: FF₁₆ = 255₁₀ (maximum value of an unsigned byte)
Convert 1A3F to Decimal
Hex: 1A3F
1 × 16³ = 1 × 4096 = 4096
A (10) × 16² = 10 × 256 = 2560
3 × 16¹ = 3 × 16 = 48
F (15) × 16⁰ = 15 × 1 = 15
4096 + 2560 + 48 + 15 = 6719
Result: 1A3F₁₆ = 6,719₁₀
Convert DEADBEEF to Decimal
DEADBEEF is a famous "hexspeak" debug marker used to mark uninitialized memory.
Hex: DEADBEEF
D (13) × 16⁷ = 13 × 268,435,456 = 3,489,660,928
E (14) × 16⁶ = 14 × 16,777,216 = 234,881,024
A (10) × 16⁵ = 10 × 1,048,576 = 10,485,760
D (13) × 16⁴ = 13 × 65,536 = 851,968
B (11) × 16³ = 11 × 4,096 = 45,056
E (14) × 16² = 14 × 256 = 3,584
E (14) × 16¹ = 14 × 16 = 224
F (15) × 16⁰ = 15 × 1 = 15
Result: DEADBEEF₁₆ = 3,735,928,559₁₀
Convert Color Code #3A7BD5 to Decimal
CSS hex color codes encode RGB channel values as pairs of hex digits.
Full value: 3A7BD5₁₆ = 3,833,813₁₀
Per channel (each pair is one byte):
Red: 3A₁₆ = 3 × 16 + 10 = 58
Green: 7B₁₆ = 7 × 16 + 11 = 123
Blue: D5₁₆ = 13 × 16 + 5 = 213
RGB result: (58, 123, 213) — a shade of blue
Hex to Decimal in Programming
Most programming languages provide built-in functions for hex-to-decimal conversion.
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
#FF5733encode 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
- Hex to Binary Converter — Convert hexadecimal numbers to binary with 4-bit group visualization
- Hex to RGB Converter — Convert hex color codes to RGB values for web design
- Hex to Text Converter — Decode hexadecimal strings into readable ASCII text
- Binary to Decimal Converter — Convert binary numbers to decimal representation
- Binary to Octal Converter — Convert binary numbers to octal (base-8) values