Skip to content
CalcWorld

Browse all tools

Hex to Decimal Converter

The hex to decimal converter multiplies each hexadecimal digit by its power of 16 and adds the results: 2F = 2 × 16 + 15 × 1 = 47. A leading # is ignored, so colour codes such as #1A work too.

Sources: Wikipedia, W3C Updated

How to convert hex to decimal

Each hexadecimal digit is worth a power of 16, read from the right starting at 16⁰ = 1. Take 2F.

  1. Turn any letters into numbers: A = 10, B = 11 and so on, so F = 15.
  2. Multiply each digit by its place value: 2 × 16 = 32 and 15 × 1 = 15.
  3. Add the results: 32 + 15 = 47.

Type 2F into the box and the tool returns Decimal: 47, worked out with JavaScript's parseInt(hex, 16). The same idea with powers of 2 is the binary to decimal converter.

Place value table for hex 2F: place values 16 and 1, digits 2 and F (15), worth 32 and 15. The sum 32 + 15 = 47.
The 2 is in the sixteens place and F means 15, so 2F = 32 + 15 = 47.

Hex colour codes and the # prefix

The box is built with colour codes in mind: a leading # is removed before converting, so #1A and 1A both give 26. Anything other than 0 to 9 and A to F in either case gives "Invalid hex value. Use only 0-9 and A-F" instead of a wrong answer.

A six-digit CSS colour is three two-digit hex numbers for red, green and blue. #FF8000 is red FF = 255, green 80 = 128 and blue 00 = 0, an orange. Convert each pair on its own to get the three channel values.

Hex to decimal chart

HexDecimalHexDecimal
A1080128
F15FF255
1016100256
1A263E81000
2F47FFFF65535
64100FFFFFF16777215 (white in RGB)

Powers of 16

The place values from the right are 1, 16, 256, 4,096, 65,536 and 1,048,576. A hex number with n digits can be as large as 16ⁿ − 1, so two digits reach 255 and four reach 65,535.

Because 16 = 2⁴, each hex digit is also four binary digits; the hex to binary converter uses that. For octal and the other directions, use the hex converter, and all the tools are on the number system converters page.

Hex to Decimal Converter: FAQ

What is FF in decimal?

255. F is 15, so FF = 15 × 16 + 15 = 255, the largest value of one byte.

Is hex case sensitive?

No. 2f and 2F are the same number, and the converter accepts both.

How do I convert decimal back to hex?

Divide by 16 again and again and read the remainders from the bottom up. The decimal to hexadecimal converter shows each division.

Sources