Menu

Hex to Decimal Converter

Type a hexadecimal number and read its decimal value, with every step of the calculation shown underneath. It opens on FF, which is 255.

By Nethanel Bar, Co-founder & CEO

Last updated

Ready to actually learn to code?

Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.

How to convert hex to decimal

Hexadecimal is base 16. It uses the digits 0 to 9 and the letters A to F, where A is 10, B is 11 and so on up to F, which is 15. Each position is worth 16 times the one to its right: the rightmost digit counts ones, the next counts sixteens, then 256s, then 4096s.

To convert, take each digit's value, multiply it by its place value and add everything up. 2A is 2 × 16 + 10 × 1 = 42. 1F4 is 1 × 256 + 15 × 16 + 4 × 1 = 500. The panel under the converter writes out these lines for whatever you type.

The converter accepts upper or lower case and an optional 0x prefix, and it uses BigInt arithmetic, so values past 2⁵³ such as FFFFFFFFFFFFFFFF convert exactly.

What to know about hex numbers

  • Hex digits run from 0 to 9, then A (10), B (11), C (12), D (13), E (14) and F (15).
  • Place values are powers of 16: 1, 16, 256, 4096, 65536.
  • Two hex digits make one byte, so they cover 0 to 255: 00 is 0 and FF is 255.
  • 0x in front of a number, as in 0xFF, only marks it as hex. It is not part of the value.

Hex to decimal, worked out

A byte: FF

Hex

FF

Decimal

255

F × 16 + F × 1 is 15 × 16 + 15 = 240 + 15 = 255, the largest value one byte can hold.

A web color

Hex

#1E90FF

Decimal

rgb(30, 144, 255)

Each pair of digits is one color channel: 1E is 1 × 16 + 14 = 30, 90 is 9 × 16 = 144 and FF is 255.

Three digits: 1F4

Hex

1F4

Decimal

500

1 × 256 + 15 × 16 + 4 × 1 = 256 + 240 + 4 = 500.

A 16-bit limit

Hex

0x7FFF

Decimal

32767

7 × 4096 + 15 × 256 + 15 × 16 + 15 = 32767, the largest signed 16-bit integer.

Common hex to decimal mistakes

  • Reading a letter as something other than a digit. In hex, A is 10 and F is 15, and no single digit is worth more than 15.
  • Counting positions from the left. The rightmost digit is position 0 and is worth 1.
  • Multiplying by 10 instead of 16. Hex 10 is sixteen, not ten.
  • Keeping the 0x or # prefix in the arithmetic. Drop it before converting.

Hex to decimal FAQ

What is FF in decimal?
255. Each F is 15, so FF is 15 × 16 + 15 = 255, the largest value that fits in one byte.
What is hex 10 in decimal?
16. The 1 sits in the sixteens place, so hex 10 is 1 × 16 + 0 = 16.
How do I convert hex to decimal in Python or JavaScript?
In Python, int('FF', 16) returns 255. In JavaScript, parseInt('FF', 16) returns 255; for values above 2⁵³ use BigInt('0xFF') so nothing is rounded.
Why does hex use letters?
Base 16 needs sixteen single symbols and there are only ten digits. The letters A to F fill the six missing values, 10 to 15.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED