Web & Developer Tools

Hex to Decimal Converter

Convert hexadecimal integers to decimal and inspect the positional-value result.

Hex to Decimal Converter — Online Calculator

Hex to Decimal Converter

0x

Accepts numbers (0-9) and letters (A-F).

0

The decimal equivalent.

The Hex to Decimal Converter translates a hexadecimal (base-16) number into its decimal (base-10) value exactly, using big-integer arithmetic so even very long hex strings, memory addresses, hashes, and key material, convert without the precision loss ordinary floating-point math would introduce. Prefixes are optional: paste with or without 0x or #.

How It Works

Hexadecimal is positional notation in base 16, with digits 0 to 9 and letters A to F standing for 10 to 15. Each position is worth 16 times the one to its right, so conversion multiplies each digit by its power of 16 and sums:

Decimal=∑digiti×16i\text{Decimal}=\sum \text{digit}_{i}\times 16^{i}

The converter validates the input strictly (hex characters only, after stripping a #, 0x, or 0X prefix) and then performs the conversion in arbitrary precision, which is the feature that matters most in practice: standard JavaScript numbers lose integer precision beyond 2^53, silently corrupting the tail of a long value, while this converter's big-integer path keeps every digit exact.

Worked example

Convert 1A3F: F is 15 x 16^0 = 15; 3 is 3 x 16^1 = 48; A is 10 x 16^2 = 2,560; 1 is 1 x 16^3 = 4,096. The sum is 6,719. Reading a result backwards is the fastest sanity check in the other direction: 6,719 in hex must end in F (6,719 mod 16 = 15), and it does.

Reference values worth recognizing

| Hex | Decimal | Where you meet it | |---|---|---| | FF | 255 | One byte, full channel in a colour | | FFFF | 65,535 | 16-bit maximum | | FFFFFF | 16,777,215 | 24-bit colour space size | | FFFFFFFF | 4,294,967,295 | 32-bit unsigned maximum | | 100 | 256 | The byte-count boundary |

Colour hex repays a second look through this lens: a CSS colour like #FF5733 is three byte-sized hex numbers in a trench coat, FF = 255 red, 57 = 87 green, 33 = 51 blue, which the Image Color Picker and Color Converter on this site unpack into RGB and HSL for design work. Recognizing that each pair is one base-16 byte is most of what "reading hex" means in daily development.

Where hex shows up, and why developers convert it

Hex persists because it is the compact human notation for binary: one hex digit is exactly four bits, so a byte is always two digits and a 64-bit value always sixteen, alignments decimal cannot offer. You will convert it when reading memory addresses and pointer values in a debugger, inspecting bytes in a hex editor or packet capture, decoding colour values from design files, checking Unix permission and flag bitmasks stored as hex, working with cryptographic hashes and identifiers (a SHA-256 digest is 64 hex digits naming a 256-bit number far beyond float precision, the case this converter's big-integer path exists for), and translating between the representations protocols use on the wire and the numbers logs print. The Number Base Converter on this site covers the general case (binary, octal, decimal, hex in both directions) when the conversion is not specifically hex-to-decimal.

Input rules and common errors

Only the characters 0-9 and A-F are valid, in either case; anything else, including a stray space inside the number, a decimal point, or the letters G onward, is rejected with the reason rather than partially converted, because a converter that quietly drops an invalid digit returns a confidently wrong number. The two classic input mistakes are including a second prefix (##FF or 0x0xFF) and pasting a colour with an alpha channel (#RRGGBBAA, eight digits): the latter is actually valid hex and will convert, to a much larger decimal that is not what a colour question meant to ask, so trim to the six colour digits when a colour is the subject.

Frequently Asked Questions

Why does the converter support such enormous numbers?

Because hex is how computing names enormous numbers: hashes, keys, and 128-bit identifiers are routine inputs, and at those sizes approximate conversion is wrong conversion. Big-integer arithmetic costs nothing at this scale and keeps the last digit as trustworthy as the first.

Is 0x1A3F the same as 1A3F?

Yes: the 0x prefix is a notation convention (C-family languages) announcing that what follows is hexadecimal; the value is identical. The # prefix is the colour-notation convention and is likewise stripped. Bare digits are interpreted as hex because that is this converter's one job.

How do I convert decimal back to hex?

Use the Number Base Converter, which runs every direction. By hand, divide repeatedly by 16 and read the remainders upward, mapping 10 to 15 onto A to F, the inverse of the positional sum shown here.

Related Tools