Skip to content

Hex to Decimal Converter (Hexadecimal to Decimal)

Convert hexadecimal to decimal and see each place-value contribution. For example, FF gives 255 because 15 × 16 + 15 = 255.

Runs in your browser Free, no sign-up
Loading tool workspace...

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

  1. Enter hex values separated by spaces or commas, for example FF 1F4; 0x prefixes are fine.
  2. Read the decimal results.
  3. For a single byte, check the summary in other bases and ASCII.
  4. 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:

  1. Write the digits with their values: D = 13, E = 14, A = 10, D = 13.
  2. Give each digit its place value, counting from the right: 4096, 256, 16 and 1.
  3. Multiply: 13 × 4096 = 53,248; 14 × 256 = 3,584; 10 × 16 = 160; 13 × 1 = 13.
  4. 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)   # 57005

C

#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")   → -1

HEX2DEC 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   # 26

Hex 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

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

Common hex values in decimal

HexDecimalWhere you see it
0x0A10Line feed (\n)
0x101616¹, the first two-digit hex number
0x12181 × 16 + 2; reads like twelve but is eighteen
0x182424, the prefix length of a /24 network
0x1A26ASCII SUB, the Ctrl+Z end-of-file marker in DOS text files
0x1C28ASCII file separator (FS)
0x1F31Largest 5-bit value; the last ASCII control code
0x2032ASCII space, written %20 in URLs
0x2537ASCII "%"
0x2840ASCII "("
0x2A42ASCII "*"
0x2C44ASCII ","
0x2E46ASCII ".", the dot in file names and IP addresses
0x3351ASCII digit "3"
0x3856ASCII digit "8"
0x3F63ASCII "?"; also the largest 6-bit value
0x4064ASCII "@"; only bit 6 is set
0x4165ASCII "A"
0x4670ASCII "F"
0x5C92ASCII backslash (\)
0x6B107ASCII "k"
0x6C108ASCII "l"
0x7F127Largest signed 8-bit value; ASCII DEL
0x80128A byte with only the high bit set
0x9B155The 8-bit CSI control code used by some terminals
0xA8168Second octet of 192.168.x.x addresses
0xA9169"©" in Latin-1 and Unicode (U+00A9)
0xC0192First octet of 192.168.x.x addresses
0xCC204x86 INT3 breakpoint opcode
0xE0224First octet of multicast addresses (224.x.x.x)
0xEB235x86 short JMP opcode
0xF4244x86 HLT opcode
0xF8248Last octet of a /29 mask, 255.255.255.248
0xFE254254, the last usable host in a /24
0xFF255Largest byte; a full channel in #RRGGBB
0x10025616², one more than a byte can hold
0x200512512, the classic disk sector size
0x4001,0241 KiB
0x10004,0964 KiB, a common memory page size
0x20008,1928 KiB, a common I/O buffer size
0x400016,38416 KiB, the memory page size on Apple silicon
0xDEAD57,005Half of the 0xDEADBEEF debug marker; worked step by step above
0xFFFF65,535Largest unsigned 16-bit value; highest TCP/UDP port
0x7FFFFFFF2,147,483,647Largest signed 32-bit integer
0xFFFFFFFF4,294,967,295Largest 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.

More converters tools

View all