Hex to Decimal (and Decimal to Hex): How to Convert, With a Chart

Hex to Decimal: Step by step, with colour codes
Spread the love

Hexadecimal (hex) is base 16. It uses the digits 0–9 and the letters A–F (A = 10 up to F = 15). Programmers use it for colour codes, memory addresses and error codes because two hex digits describe exactly one byte.

Quick answer

  • Hex to decimal: multiply each digit by its power of 16 (1, 16, 256, 4,096…, from the right) and add.
  • Decimal to hex: divide by 16 repeatedly and read the remainders from bottom to top.
  • Example: FF = 15 × 16 + 15 = 255.

Hex to decimal, step by step

Convert 1A3:

Digit Value Place value Digit × place
1 1 256 256
A 10 16 160
3 3 1 3

Add them up: 419.

Decimal to hex, step by step

Convert 419:

Division Result Remainder
419 ÷ 16 26 3 (3)
26 ÷ 16 1 10 (A)
1 ÷ 16 0 1 (1)

Read the remainders from bottom to top: 1A3.

Hex chart

Hex Decimal Binary
0 0 0
1 1 1
5 5 101
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
10 16 10000
20 32 100000
40 64 1000000
64 100 1100100
7F 127 1111111
80 128 10000000
FF 255 11111111
100 256 100000000

Hex colour codes

Web colours like #F97316 are three pairs of hex digits for red, green and blue, each from 00 (0) to FF (255).

Colour code Red Green Blue
#F97316 249 115 22
#2B5FE0 43 95 224
#0D1730 13 23 48
#FFFFFF 255 255 255
#000000 0 0 0

Why programmers like hex

One hex digit is exactly 4 bits, so a byte (8 bits) is always two hex digits: 11111111 in binary is FF in hex. That makes long binary values much easier to read. See binary to decimal for the base-2 version.

Frequently asked questions

How do you convert hex to decimal?

Multiply each digit by its power of 16 and add.

What is FF in decimal?

255.

What is 100 in hex?

64.

What does 0x mean?

It’s a prefix that marks a number as hex, as in 0xFF.

Related guides

Related guides

Leave a Reply

Your email address will not be published. Required fields are marked *