Hex to Decimal Converter

Convert hexadecimal to decimal and back — edit either field and the other updates, with optional 0x or # prefixes.

Hex to Decimal Converter

A leading 0x or # is optional and ignored. Hex accepts 0–9 and A–F.

🔒 Nothing you enter is sent anywhere or stored. All processing happens in your browser.

How it works

Hexadecimal (base 16) packs four bits into a single digit, which makes it the go-to shorthand for colours, memory addresses, byte values and hashes. Its digits run 0–9 and then A–F for the values ten to fifteen. This tool converts hex to plain decimal and decimal back to hex, both at the same time.

Paste or type a hex value on the left — with or without a leading 0x or # — and its decimal value appears on the right instantly. Type a decimal number on the right and the uppercase hex equivalent appears on the left. The fields are linked, so there is no button to press. Whitespace is stripped and both common prefixes are accepted, which is handy when pasting CSS colours or code snippets.

Input is validated: hex must use only 0–9 and A–F, and decimal must be a non-negative whole number. Invalid input shows an error rather than a wrong number, and conversions are exact even for very large values thanks to arbitrary-precision integers.

Examples

Hex 0xFF → decimal 255.
CSS colour component #1A → decimal 26.
Decimal 4096 → hex 1000.
Hex 1G → error, because G is not a hex digit.

Frequently asked questions

Can I paste values with 0x or # in front?
Yes. A single leading 0x or # is recognised and ignored, so pasting code or CSS colour values just works.
Is the output upper or lower case?
The decimal-to-hex result is shown in uppercase. On input, upper and lower case hex are both accepted.
Does it work for colour codes?
Yes for individual hex components. Convert each pair (like 1A) to see its 0–255 decimal value.
Can it handle very large hex numbers?
Yes. It uses arbitrary-precision integers, so long hex strings convert to decimal exactly.
Is anything sent to a server?
No. All conversion happens in your browser, so your values stay on your device.