FLXCode Hex to Decimal Converter

FLXCode apps

Appearance

Hex to Decimal Converter

Type a hex number such as 1A3F or 0xFF. You get the decimal value and the sum of place values behind it.

Example

6719

1A3F in base 16 (hexadecimal) is 6719 in base 10 (decimal).

Steps

  1. Each digit is worth its value times a power of 16: 1A3F = 1 × 16³ + 10 × 16² + 3 × 16¹ + 15 × 16⁰ = 6719.

The same number in the common bases

BaseValue
base 2 (binary)0001 1010 0011 1111
base 8 (octal)15077
base 10 (decimal)6719
base 16 (hexadecimal)1A3F

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

Worked examples

HexDecimalNote
FF255One byte, all bits set
1A3F67191 × 4096 + 10 × 256 + 3 × 16 + 15
0x1016The prefix is accepted and ignored: 16
7FFFFFFF2147483647The largest signed 32-bit integer
FFFFFFFF4294967295The largest unsigned 32-bit integer
DEADBEEF3735928559A famous debug marker

The six letters

A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. The digits 0 to 9 keep their own value.

Place values: powers of 16

PlaceWorth
16⁰1
16¹16
16²256
16³4096
16⁴65536
16⁵1048576
16⁶16777216
16⁷268435456

A colour code, channel by channel

#FF8800 has three pairs: FF, 88, 00. Converted they are 255, 136, 0, so the colour is rgb(255, 136, 0). Each channel runs from 0 (00) to 255 (FF).

Going the other way

To write a decimal number in hex use the decimal to binary converter and change its To base to 16, or open the number base converter, which has all the bases from 2 to 36. Hex and binary line up four bits to a digit, so binary to decimal reads the same table in a different alphabet.

Numbers this uses

  • Digits 0 to 9 and A to F, case does not matter. A leading 0x is accepted.
  • Up to 1,000 characters, exact (BigInt).
  • The result is the unsigned value. Two's complement for a negative hex number is listed when you type a minus sign.

Nothing you type is uploaded. We count events without cookies (details).

FAQ

How do you convert hex to decimal by hand?

Give each hex digit its value (A = 10 up to F = 15), multiply by 16 to the power of its position counting from 0 on the right, and add. For 2F: 2 × 16 + 15 × 1 = 47. A faster way is to go left to right: take the first digit, multiply the running total by 16, add the next digit, and repeat.

Is it fine to type lowercase letters or a 0x in front?

Yes. ff, FF and 0xFF all give 255. A # in front, as in a web colour, is not accepted, so drop it first. Spaces and underscores in the middle are ignored, so DEAD BEEF works.

How do I read a hex colour code like #FF8800?

Split it into three pairs. Each pair is one channel from 0 to 255: red FF = 255, green 88 = 136, blue 00 = 0. So #FF8800 is rgb(255, 136, 0), an orange. Convert each pair on its own with this tool.

Why is FFFF sometimes 65535 and sometimes -1?

It depends on how the bits are read. Read as unsigned, FFFF is 65535. Read as a signed 16-bit two's complement number, the top bit means negative, so FFFF is −1 and FFFE is −2. This tool gives the unsigned value. For a signed reading subtract 65536 when the first digit is 8 or higher: FFFE gives 65534 − 65536 = -2.

Why do programmers use hex?

One hex digit is exactly four bits, so a byte is always two digits and the bits are easy to see: F is 1111, 0 is 0000. Memory addresses, colours, MAC addresses and file signatures are all written in hex for that reason.

How long can the hex number be?

Up to 1,000 characters. The tool uses BigInt, so a 64-digit hash converts without losing a digit. Plain calculators that use floats go wrong above 2⁵³, around the 14th hex digit.

Can I convert a hex fraction?

Yes, put a point in it. A.8 in hex is 10.5 in decimal, because the first place after the point is worth 1/16 and 8/16 = 0.5. Fractions that do not end are cut after 64 digits and marked.

Is my hex value saved or sent anywhere?

No. It is converted in your browser. What you type is not put in the address bar, not stored and not counted. We only count the target base of the conversion.

More from FLXCode

Share Hex to Decimal Converter