Hexadecimal to Decimal Converter – Free

Enter a base-16 number and this hex to decimal converter returns its base-10 value. For example, 2d is 45 and FF is 255. Large values are converted without rounding.

How to use the Hexadecimal to Decimal tool

  1. Type the hex value into the Base-16 number box, for example 2d or 0x2D.
  2. Select Convert to calculate the decimal value.
  3. Read the base-10 number in the Result box. It is printed without thousands separators.
  4. Select Copy to copy the number, or Example to see 2d converted to 45.

How to convert hex to decimal

Hexadecimal is positional, like decimal, but each place is worth sixteen times the place to its right: 1, 16, 256, 4096 and so on. The letters A to F stand for 10 to 15. To convert, multiply each digit by its place value and add the products.

The tool does the same thing from left to right: it starts at zero and, for each digit, multiplies the running total by 16 and adds the digit.

1F4 = 1 x 256  +  15 x 16  +  4 x 1
    = 256      +  240      +  4
    = 500

Hex to decimal reference values

These are the boundaries that come up most often: the largest byte, the largest unsigned 16-bit value, and the largest signed and unsigned 32-bit integers.

A         ->  10
FF        ->  255
3E8       ->  1000
FFFF      ->  65535
7FFFFFFF  ->  2147483647
FFFFFFFF  ->  4294967295

Signed values and big numbers

The converter treats the digits as an unsigned magnitude. FFFFFFFF is 4294967295, not -1, because nothing in a hex string says how wide the integer is or whether its top bit is a sign. To read a value as signed two's complement, convert it, and if the top bit of your word is set, subtract 2 to the power of the word size. For 32 bits, 4294967295 - 4294967296 = -1. A leading minus sign is accepted and simply negates the result: -2d gives -45.

Results are exact at any length. FFFFFFFFFFFFFFFF converts to 18446744073709551615. In JavaScript, parseInt on that string returns 18446744073709552000, because the Number type cannot hold integers above 2^53 precisely.

Input rules and typical uses

Enter one number of up to 4,096 characters using 0 to 9 and A to F in any case, optionally starting with 0x. A number sign as in CSS colors, a trailing h, spaces and colons are rejected with an Invalid base-16 digit message, so strip them first. The conversion runs client-side in your browser.

Developers reach for this conversion when reading error codes, memory offsets and sizes from logs, Unicode code points, and the chunk sizes in HTTP chunked transfer encoding, which are sent in hex: a chunk header of 1B0 announces 432 bytes.

Frequently asked questions

What is 2D in decimal?

2D is 45. The 2 is in the sixteens place, giving 32, and D is 13. 32 + 13 = 45.

What is FF in decimal?

FF is 255, which is 15 x 16 + 15. It is the maximum value of one byte and of each channel in an RGB color.

Is hex input case-sensitive?

No. The tool lowercases the input before parsing, so 2d, 2D and 0X2D all return 45.

Why is FFFFFFFF shown as 4294967295 and not -1?

The converter returns the unsigned value. Whether those bits mean -1 depends on reading them as a signed 32-bit integer. Subtract 4294967296 from the result when the top bit is set to get the signed value.

Can I convert a hex color like #FF00FF?

Remove the number sign first. FF00FF converts to 16711935 as one number. For separate red, green and blue values, convert each pair on its own: FF is 255 and 00 is 0.

Does this convert hex fractions such as 1A.8?

No. Only whole numbers are supported, and the point is reported as an invalid digit. Convert the integer part here and handle the fraction separately, where each place after the point is a negative power of 16.

Related tools