What is Hex to Decimal Converter?
This hex to decimal converter turns base-16 (hexadecimal) values into base-10 numbers, the decimal numbers that UK schools call denary. In hex, each position is a power of 16 and the digits A to F stand for 10 to 15, so FF is 15×16 + 15 = 255 and 1F4 is 1×256 + 15×16 + 4 = 500.
Paste one hex value or several separated by spaces, such as FF 1F4 7FFFFFFF, to convert each one; to see the decimal value of every byte in a dump, separate the bytes with spaces (48 65 6C 6C 6F). For a single value, a summary shows it in binary, octal, hex and as an ASCII character too.
How to use Hex to Decimal Converter
- Enter hex values separated by spaces or commas, for example FF 1F4; 0x prefixes are fine.
- Read the decimal results.
- For a single byte, check the summary in other bases and ASCII.
- Copy the result, or click Swap to convert decimal to hex.
Key features
- Convert many values at once, separated by spaces or commas
- Exact results for numbers of any size, including 64-bit values
- Output separated by spaces, commas, new lines or nothing
- Uppercase or lowercase hex, optional 0x prefix, and binary padded to whole 8-bit bytes
- Swap button to reverse the conversion direction
- Summary of a single value in binary, octal, decimal, hex and ASCII
- Clear errors for invalid digits; runs entirely in your browser
Common use cases
- Converting hex color channels to RGB values (FF = 255)
- Reading memory addresses, error codes and IDs from logs
- Turning hex byte dumps into decimal byte values
- Converting Unicode code points such as U+00E9 to decimal
- Checking computer science homework
Technical details & standards
Multiply each digit by 16 raised to its position, counting from 0 on the right, and add the results: 2A3 = 2×256 + 10×16 + 3 = 675. Useful landmarks are FF = 255, FFFF = 65,535 and 7FFFFFFF = 2,147,483,647, the largest signed 32-bit integer.
Each value separated by spaces or commas is converted as one whole number, so 1F4 gives 500 and 1F4 FF gives 500 255. The arithmetic uses arbitrary-precision integers, so 64-bit values such as FFFFFFFFFFFFFFFF (18,446,744,073,709,551,615) are exact, beyond the 2^53 limit of ordinary JavaScript numbers.
The hexadecimal formula: each digit × 16ⁿ
Going from hex to decimal uses one formula: multiply each digit d by 16ⁿ, where n is its position counted from 0 on the right, and add the results. The place values run 1, 16, 256, 4096 and so on. Here is 0xDEAD, which uses three different letter digits:
- Write the digits with their values: D = 13, E = 14, A = 10, D = 13.
- Give each digit its place value, counting from the right: 4096, 256, 16 and 1.
- Multiply: 13 × 4096 = 53,248; 14 × 256 = 3,584; 10 × 16 = 160; 13 × 1 = 13.
- Add the four products: 53,248 + 3,584 + 160 + 13.
Result: 0xDEAD is 57,005 in decimal. Two-digit values are quicker: the first digit times 16 plus the second, so C0 = 12 × 16 = 192 and 2E = 2 × 16 + 14 = 46.
Hex to int in JavaScript, Python, C, Excel and bash
In code, hex to dec means parsing a hex string into an integer. Each line below gives the value shown beside it.
JavaScript
parseInt("2E", 16); // 46
Number("0xA8"); // 168
BigInt("0xFFFFFFFFFFFFFFFF").toString(); // "18446744073709551615"parseInt stops at the first character that is not a hex digit, so check your input; BigInt keeps 64-bit values exact.
Python
int("2e", 16) # 46
int("0xA8", 0) # 168, base 0 reads the 0x prefix
int("dead", 16) # 57005C
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("%ld\n", strtol("2E", NULL, 16)); /* 46 */
printf("%ld\n", strtol("0xA8", NULL, 16)); /* 168 */
printf("%lu\n", strtoul("DEAD", NULL, 16)); /* 57005 */
return 0;
}Excel
=HEX2DEC("FF") → 255
=HEX2DEC("1A") → 26
=HEX2DEC("FFFFFFFFFF") → -1HEX2DEC reads up to 10 hex digits and treats a 10-digit value starting with 8–F as a negative 40-bit number, so FFFFFFFFFF is −1.
bash
echo $((16#FF)) # 255
echo $((0x2E)) # 46
printf "%d\n" 0x1A # 26Hex to decimal conversion table
Each hex digit stands for a value from 0 to 15. The first table lists all 16 digits; the second lists hex values that come up often in code, with their decimal equivalents. A 0x prefix only marks a number as hex, so 0xFF and FF are both 255.
Hex digits 0–F in decimal and binary
| 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 |
Common hex values in decimal
| Hex | Decimal | Where you see it |
|---|---|---|
| 0x0A | 10 | Line feed (\n) |
| 0x10 | 16 | 16¹, the first two-digit hex number |
| 0x12 | 18 | 1 × 16 + 2; reads like twelve but is eighteen |
| 0x18 | 24 | 24, the prefix length of a /24 network |
| 0x1A | 26 | ASCII SUB, the Ctrl+Z end-of-file marker in DOS text files |
| 0x1C | 28 | ASCII file separator (FS) |
| 0x1F | 31 | Largest 5-bit value; the last ASCII control code |
| 0x20 | 32 | ASCII space, written %20 in URLs |
| 0x25 | 37 | ASCII "%" |
| 0x28 | 40 | ASCII "(" |
| 0x2A | 42 | ASCII "*" |
| 0x2C | 44 | ASCII "," |
| 0x2E | 46 | ASCII ".", the dot in file names and IP addresses |
| 0x33 | 51 | ASCII digit "3" |
| 0x38 | 56 | ASCII digit "8" |
| 0x3F | 63 | ASCII "?"; also the largest 6-bit value |
| 0x40 | 64 | ASCII "@"; only bit 6 is set |
| 0x41 | 65 | ASCII "A" |
| 0x46 | 70 | ASCII "F" |
| 0x5C | 92 | ASCII backslash (\) |
| 0x6B | 107 | ASCII "k" |
| 0x6C | 108 | ASCII "l" |
| 0x7F | 127 | Largest signed 8-bit value; ASCII DEL |
| 0x80 | 128 | A byte with only the high bit set |
| 0x9B | 155 | The 8-bit CSI control code used by some terminals |
| 0xA8 | 168 | Second octet of 192.168.x.x addresses |
| 0xA9 | 169 | "©" in Latin-1 and Unicode (U+00A9) |
| 0xC0 | 192 | First octet of 192.168.x.x addresses |
| 0xCC | 204 | x86 INT3 breakpoint opcode |
| 0xE0 | 224 | First octet of multicast addresses (224.x.x.x) |
| 0xEB | 235 | x86 short JMP opcode |
| 0xF4 | 244 | x86 HLT opcode |
| 0xF8 | 248 | Last octet of a /29 mask, 255.255.255.248 |
| 0xFE | 254 | 254, the last usable host in a /24 |
| 0xFF | 255 | Largest byte; a full channel in #RRGGBB |
| 0x100 | 256 | 16², one more than a byte can hold |
| 0x200 | 512 | 512, the classic disk sector size |
| 0x400 | 1,024 | 1 KiB |
| 0x1000 | 4,096 | 4 KiB, a common memory page size |
| 0x2000 | 8,192 | 8 KiB, a common I/O buffer size |
| 0x4000 | 16,384 | 16 KiB, the memory page size on Apple silicon |
| 0xDEAD | 57,005 | Half of the 0xDEADBEEF debug marker; worked step by step above |
| 0xFFFF | 65,535 | Largest unsigned 16-bit value; highest TCP/UDP port |
| 0x7FFFFFFF | 2,147,483,647 | Largest signed 32-bit integer |
| 0xFFFFFFFF | 4,294,967,295 | Largest unsigned 32-bit integer |
Frequently asked questions
How do I convert hex to decimal?
Multiply each digit by a power of 16, from 16^0 on the right, and add them up. For 3C: 3×16 + 12 = 60.
What is FF in decimal?
255: F is 15, so FF is 15×16 + 15. It is the maximum value of one byte and of each channel in a #RRGGBB color.
How do I convert a hex byte string to decimal bytes?
Separate the bytes with spaces, such as 48 65 6C 6C 6F, and each byte is converted on its own (72 101 108 108 111). Without spaces, 48656C6C6F is read as one large number.
How do I convert hex to decimal in code?
JavaScript: parseInt("1F4", 16) returns 500. Python: int("1F4", 16). For values beyond 2^53 in JavaScript, use BigInt("0x1F4").
What is the hex to decimal formula?
decimal = dₙ×16ⁿ + … + d₁×16¹ + d₀×16⁰, where each digit d is 0–9 or A–F (10–15) and positions count from 0 on the right. For 2A3: 2×256 + 10×16 + 3×1 = 675.
What is 20 hex in decimal?
32, because 2×16 + 0 = 32. Other common values: 10 = 16, 1A = 26, 1F = 31, 2A = 42, 3C = 60, 40 = 64, 80 = 128, FF = 255 and FFFF = 65,535. A 0x prefix does not change the value, so 0x10 is 16 and 0x40 is 64.
What is 7F in decimal?
7F in hex is 127 in decimal: 7 × 16 + 15 = 127.
What is 0x1000 in decimal?
0x1000 is 4096 in decimal, because it equals 1 × 16³.
How do I convert hex to decimal in Excel?
Use =HEX2DEC(A1) to convert the hex text in cell A1; write the value without a 0x prefix, as in 1A or FF. To convert a whole column, fill the formula down and then paste the results as values.
How do I convert signed hex to decimal?
If the highest bit is set, subtract 2 to the power of the bit width. For example, FF as a signed 8-bit value is 255 − 256 = −1. This converter reads hex as unsigned, so FF gives 255.
Is hex to int the same as hex to decimal?
Yes. An int is a whole number, so converting hex to int gives its decimal value: 1F4 is 500 and FF is 255. The difference only shows up in code, where a signed 32-bit int tops out at 7FFFFFFF (2,147,483,647) and hex values above that need a 64-bit type or BigInt.
How do I convert hexadecimal to denary?
Denary is the name UK schools use for decimal. Multiply each hex digit by its place value, 16 for the second digit from the right, and add the results: 2F is 2 × 16 + 15 = 47, and 38 is 3 × 16 + 8 = 56.
How do I read two-digit hex values such as 2A, 1C or C0 quickly?
Multiply the first digit by 16 and add the second, remembering that A to F mean 10 to 15. 2A is 2 × 16 + 10 = 42, 1C is 16 + 12 = 28, 1F is 31 and C0 is 12 × 16 = 192. The table below lists these and other byte values people look up.