Skip to content
AgileLogics

Hex to Decimal

Converts a base-16 (hexadecimal) number into its base-10 (decimal) equivalent.

How it works

Enter a hex number (e.g. ff) and click Convert.

How do you convert hex to decimal?

Expand the number by place value. Each hex digit is worth 16 times the digit to its right, so the places are 1, 16, 256, 4096 and so on. Multiply each digit by its place value and add. Letters stand for 10 (a) through 15 (f). For 7E3, that's 7 × 256 + 14 × 16 + 3 = 2019.

This converter does the expansion instantly for values up to 53 bits (1fffffffffffff), and tells you plainly when a number is too large to handle exactly.

Using it

  1. Paste the hex digits, for example 1F600. Upper or lower case both work.
  2. Remove any 0x, # or U+ prefix.
  3. Click Convert and copy the decimal result.

Worked example: 7E3, digit by digit

Digit Value Position Place value (16^n) Product
7 7 2 256 1792
E 14 1 16 224
3 3 0 1 3
Total 2019

Keep the powers of 16 handy and longer values are just more rows:

Power Place value
16^0 1
16^1 16
16^2 256
16^3 4,096
16^4 65,536
16^5 1,048,576
16^6 16,777,216
16^7 268,435,456

Where hex numbers come from

Hex values turn up in places that expect you to know their decimal size. Three common ones:

Unicode code points. Characters are numbered in hex, written like U+1F600 in the Unicode code charts. Drop the U+ and convert 1F600 to get 128512, which is the number to use in a decimal HTML character reference such as 😀. The WHATWG HTML standard accepts both that and the hex form 😀.

HTTP chunk sizes. With chunked transfer coding, each chunk starts with its length in hex (RFC 9112, section 7.1). If a raw response shows 3e8 before a chunk, that chunk is 1000 bytes.

Integer limits in code and logs. 7fffffff is 2147483647, the largest signed 32-bit integer, and ffff is 65535. Seeing these in a crash log or a database column usually means something overflowed or hit a ceiling.

Signed or unsigned?

Hex is just a bit pattern, and the same pattern can be read two ways. This converter always reads it as an unsigned, positive number:

Hex Unsigned (tool output) As signed 32-bit
7fffffff 2147483647 2147483647
80000000 2147483648 -2147483648
ffffffff 4294967295 -1

If you know the value came from a signed 32-bit field and the result is 2,147,483,648 or more, subtract 4,294,967,296. For a 16-bit field the threshold is 32,768 and you subtract 65,536.

Inputs the converter rejects

  • 0xff, #ff, U+1F600: prefixes aren't hex digits. Delete them.
  • ff ff or de:ad: spaces and separators inside the value. Join the digits.
  • fg, 12h: letters past f. The h suffix used in some assembly languages has to go too.
  • -ff: no sign support.
  • Anything above 1fffffffffffff (leading zeros don't count): too large. JavaScript numbers are only exact up to 2^53 - 1, and the tool refuses to round.

Whitespace at either end is trimmed, and an empty box just clears the output.

Related tools

  • Decimal to hex converts back, useful for building constants or color channels.
  • Hex to binary shows the individual bits when you're decoding flags.
  • HEX to RGB splits a six-digit color code into its three decimal channels for you.
  • The HTML encoder and decoder handles character references once you have the code point.

Last updated

Frequently asked questions

How do I convert hex to decimal by hand?
Multiply each digit by 16 raised to its position, counting from 0 on the right, then add. Letters a to f are 10 to 15. For 7E3 that is 7 × 256 + 14 × 16 + 3 × 1 = 1792 + 224 + 3 = 2019.
Why does 0xFF give an error?
The converter accepts hex digits only. The 0x prefix, a # from a color code, or U+ from a Unicode code point all fail with "Enter a valid hexadecimal number". Delete the prefix and convert FF, which gives 255.
Why do I get 2147483648 instead of a negative number for 80000000?
The tool treats every hex value as unsigned. If the value is a signed 32-bit integer and the result is 2147483648 or more, subtract 4294967296 to get the signed value, so 80000000 is -2147483648.
Does capitalisation matter?
No. ff, FF and Ff all give 255.
What's the largest hex value it converts?
1fffffffffffff, which is 9007199254740991. From 20000000000000 upward you get "That number is too large to convert precisely." Values from 64-bit registers or hashes often exceed this.