Hex to decimal and decimal to hex converter

Hex to decimal: multiply each digit by a power of 16 and add, so FF (hex) = 255 (decimal) and 2A3 (hex) = 675 (decimal). Type a hex number (with or without 0x or #) and the decimal value appears as you type, with binary and octal underneath; decimal to hex works in the same box.

Source: Wikipedia: Positional notation (base conversion, place values). Updated: .

My ToolboxYour inputs are saved in this browser only.

Result

Answer
FF (hex) = 255 (decimal)
Other bases
Binary: 1111 1111. Octal: 377. Bits needed: 8.
Working
  • Add up the place values (base 16 → decimal): 15·16¹ + 15·16⁰ = 255
Conversion chart
HexDecimalBinary
000
111
2210
3311
44100
55101
66110
77111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111
10161 0000
1F311 1111
203210 0000
4064100 0000
64100110 0100
7F127111 1111
801281000 0000
FF2551111 1111
1002561 0000 0000
FFF40951111 1111 1111
FFFF655351111 1111 1111 1111
Values worth knowing
Valuehexdecimal
Largest byte (FF)FF255
Half brightness of a color channel80128
ASCII "A" (0x41)4165
Largest 16-bit valueFFFF65535
Largest 32-bit valueFFFFFFFF4294967295
Emoji U+1F6001F600128512
Pure red #FF0000FF000016711680
Orange #FF8800FF880016746496
Hex uses the digits 0-9 and A-F; the prefixes 0x and # are ignored, upper and lower case mean the same. Results are exact for numbers of any length.

How it is calculated

How to convert hex to decimal

Every hex digit stands for 0 to 15 (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15), and each place is worth 16 times the one to its right. Take 2A3: 2 × 16² + 10 × 16 + 3 = 512 + 160 + 3 = 675. For two digits there is a shortcut: first digit × 16 plus second digit, so B7 is 11 × 16 + 7 = 183. The working under the answer lists the place values for your own number.

From decimal back to hex

Divide by 16 again and again and read the remainders from the bottom: 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, so both digits are F: 255 (decimal) = FF (hex). Likewise 4,096 is 4096 (decimal) = 1000 (hex), one digit longer than 4,095, which is FFF. Remainders of 10 to 15 are written A to F.

Where hex values show up

Why hex at all

One hex digit is exactly four bits (a nibble), so two digits make a byte and the number is a compact spelling of the binary: 0xFF = 1111 1111. That is why it is used for colors, memory addresses and byte dumps. The zero-x prefix (0x) only marks the notation: 0x10 is 16, not ten. Upper- and lower-case letters mean the same.

Very large values

The conversion is exact for long numbers, far beyond 53 bits where a calculator starts to round: FFFFFFFFFFFFFFFF (16 F's) comes out as 18446744073709551615. For negative numbers, other bases and two’s complement see the number base converter; for binary specifically see binary to decimal.

Frequently asked questions

How do I convert hex to decimal?

Multiply each digit by 16 raised to its place number (counting from 0 on the right) and add. For 2A3: 2 × 256 + 10 × 16 + 3 = 675, so 2A3 (hex) = 675 (decimal).

What is FF in decimal?

FF (hex) = 255 (decimal), the largest value of one byte. FFFF is 65535.

How do I convert decimal to hex?

Divide by 16 repeatedly and write the remainders (10 to 15 as A to F) from last to first. For 255: 255 (decimal) = FF (hex).

What does the 0x in front of a hex number mean?

It only says the digits are hexadecimal. 0x1F is the same as 1F, which is 31 in decimal. The converter accepts the prefix and a leading # as well.

How do I read a hex color code in decimal?

Split it into three pairs: #FF8800 is FF, 88, 00, which is red 255, green 136, blue 0.

Sources and legal basis

As of: · Editorial policy

Related tools