GetToolSpace

Free Online Converter

Hex to Decimal Converter

Convert a hexadecimal number to decimal instantly. Accepts an optional 0x prefix, works with very large numbers, and also shows the value in binary and octal.

Try an example:

Decimal result

Your result will appear here.

Your numbers stay in your browser. They are not uploaded or saved.

The same number in other number systems

Enter a number above to see it in binary and octal as well.

Need to convert the other way? Decimal to Hex Converter

How to Convert Hexadecimal to Decimal

This guide explains how hex place values work, shows the formula behind the converter above, and covers the sizes and formats you will meet most often.

What is a hexadecimal number?

A hexadecimal (hex) number is written in base 16. It uses the digits 0 to 9 and the letters A to F, where A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. Each digit is worth 16 times more than the digit to its right, just as each digit in a decimal number is worth 10 times more.

How to convert hex to decimal

Give every digit a position, starting from 0 at the right-hand end. Convert each digit to its decimal value, multiply it by 16 raised to its position, and add the results together.

Formula

Decimal = (digit × 16^position) added together for every digit, counting positions from 0 on the right

Example: convert 1A3F to decimal

F (15) × 16^0 = 15

3 × 16^1 = 48

A (10) × 16^2 = 2,560

1 × 16^3 = 4,096

Total: 15 + 48 + 2,560 + 4,096 = 6,719

Powers of 16

These are the place values you multiply by. Each position is 16 times the one before it.

Powers of 16 for hexadecimal place values
PositionPowerValue
016^01
116^116
216^2256
316^34,096
416^465,536
516^51,048,576

Reading a hex colour code

A web colour such as #FF8800 is three hex pairs: red, green and blue. Converting each pair to decimal gives the familiar 0 to 255 values used by rgb().

Example: the colour #FF8800

FF = 15 × 16 + 15 = 255 (red)

88 = 8 × 16 + 8 = 136 (green)

00 = 0 (blue)

So #FF8800 is rgb(255, 136, 0), a bright orange.

Bytes and hex digits

Two hex digits make one byte, so you can tell the size of a value from the number of digits. The table shows the largest value that fits in each size.

Largest hexadecimal value for common byte sizes
SizeHex digitsLargest hex valueDecimal
1 byte2FF255
2 bytes4FFFF65,535
4 bytes8FFFFFFFF4,294,967,295
8 bytes16FFFFFFFFFFFFFFFF18,446,744,073,709,551,615

What input the converter accepts

  • Upper or lower case letters: FF and ff give the same result.
  • An optional 0x prefix, such as 0xFF.
  • An optional minus sign at the start for negative numbers.
  • Spaces and underscores are ignored, so FF FF and FF_FF both work.
  • Whole numbers only. Letters after F, a # sign or a decimal point will show an error.

Signed values and two's complement

The converter reads the digits you enter as a plain positive number, so FFFFFFFF is 4,294,967,295. If that value is a signed 32-bit number, where the top bit marks a negative, subtract 2^32 (4,294,967,296) to get the signed value. Here that gives -1. Type a minus sign yourself, such as -FF, to convert a negative hex number directly.

Frequently Asked Questions

How do I convert hex to decimal?

Multiply each hex digit by 16 raised to its position, counting from 0 at the right, then add the results. For 2EE that is 2 × 256 + 14 × 16 + 14 = 750. Or paste the hex value into the converter above.

What is FF in decimal?

FF in hexadecimal is 255 in decimal, because 15 × 16 + 15 = 255. It is the largest value a single byte can hold.

Is hexadecimal case sensitive?

No. The letters A to F can be upper or lower case. For example, 1a3f and 1A3F both equal 6,719.

What does 0x mean in front of a number?

0x is a prefix used by many programming languages to show that the number is hexadecimal. It is not part of the value, and this converter accepts it or ignores it.

Why does the converter show an error for my hex value?

Hex uses only 0-9 and A-F. The most common causes are a letter past F, such as G, a # sign copied from a colour code, or a decimal point. Remove those characters and try again.

Can it convert very large hex numbers?

Yes. It uses arbitrary-precision integers, so large values stay exact. FFFFFFFFFFFFFFFF converts to 18446744073709551615. Input is limited to 2,000 characters.

Are the values I enter saved?

No. Every conversion runs in your browser, and nothing you type is sent to our server or stored.

Important Note

This converter gives mathematical results for whole numbers. For work where a wrong value matters, such as firmware or security, double-check the result in your own tools.