colorcodekit

Hex to decimal

Type a hexadecimal number and get the decimal value, with the working. Handles any length and a 0x or # prefix.

—

Working


Switch to decimal to hex

How hex to decimal works

Hexadecimal is base 16. It uses sixteen digits: 0 to 9 and then A to F for the values ten to fifteen. Each position is worth 16 times the one to its right, so the digits from right to left are worth 1, 16, 256, 4,096 and so on.

To convert, multiply each digit by its place value and add the results. For 1F4: 1×256 + 15×16 + 4×1 = 256 + 240 + 4 = 500. The converter shows the same working for whatever you type.

Hex digits

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

Common values

DecimalHexBinary
000
111
991001
10A1010
15F1111
161010000
3220100000
64401000000
100641100100
1277F1111111
1288010000000
192C011000000
200C811001000
255FF11111111
256100100000000
1,0003E81111101000
4,095FFF111111111111
65,535FFFF1111111111111111

How big can a hex number get?

Each extra hex digit multiplies the range by 16. Two digits cover 0 to 255, which is one color channel or one byte.

Hex digitsLargest valueDecimal
1F15
2FF255
3FFF4,095
4FFFF65,535
6FFFFFF16,777,215
8FFFFFFFF4,294,967,295

Hex numbers and hex colors

A hex color code such as #9CAF88 is three hex numbers side by side: red 9C = 156, green AF = 175 and blue 88 = 136. That is why each channel runs from 0 to 255, because FF is the largest two-digit hex number. If the hex number has exactly six digits, the converter also shows it read as a color. For color work, the hex to RGB and RGB to hex converters split a code into its three channels for you.

Things that trip people up

  • Hex 10 is sixteen, not ten. The digits run 0 to F before the number carries.
  • Letters are numbers. A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
  • Prefixes are not part of the number. 0x1F4, #1F4 and 1F4 are the same value. This converter ignores the prefix.
  • Leading zeros change nothing. 00FF and FF are both 255. They matter only for fixed-width fields, such as a six-digit color code.

Related converters

Frequently asked questions

How do I convert hex to decimal?

Multiply each hex digit by 16 raised to its position, counting from 0 on the right, and add the results. For 1F4: 1×16² + 15×16¹ + 4×16⁰ = 256 + 240 + 4 = 500.

What is FF in decimal?

255. F is 15, so FF is 15×16 + 15 = 255, the largest value of one color channel in a hex color code.

Does it matter if I use uppercase or lowercase letters?

No. A to F and a to f mean the same digits. A leading 0x or # is also accepted and ignored.

What is the hex 10 in decimal?

16. Hex digits count from 0 to F, so the number after F is 10, which is sixteen.

Content updated