What This Hex to Decimal Converter Does
This tool converts a hexadecimal (base-16) number into its decimal (base-10) value and also shows you the binary (base-2) equivalent. You type a hex number into the single input field — Hexadecimal Number — and the calculator instantly returns both the decimal result and the matching string of 1s and 0s. It's handy for programmers reading memory addresses or colour codes, students learning number systems, and anyone working with low-level data.
How to Use It
- Enter your hexadecimal value in the Hexadecimal Number field. Hex uses the digits 0–9 plus the letters A–F (case does not matter, so
FFandffwork the same). - The converter reads your input and produces two outputs: the decimal value and the binary representation.
- Use it for whole-number hex values such as
1A,FF, or2F4B— no decimal point or "0x" prefix is needed.
The Formula Behind It
Each hex digit represents a power of 16. Reading from right to left, the rightmost digit is multiplied by 16⁰, the next by 16¹, then 16², and so on. The decimal value is the sum of all these products:
Decimal = Σ (digit × 16position)
Internally the tool uses Long.parseLong(hex, 16) to parse the string as a base-16 number, then Long.toBinaryString() to generate the binary equivalent from that decimal result.
Worked Example
Suppose you enter 2F:
- The digit
Fequals 15, in the 16⁰ place: 15 × 1 = 15 - The digit
2is in the 16¹ place: 2 × 16 = 32 - Add them together: 32 + 15 = 47 (decimal)
- The binary equivalent of 47 is 101111
So entering 2F returns a decimal value of 47 and a binary value of 101111.
Frequently Asked Questions
Does capitalisation matter? No. Hex letters A–F are case-insensitive, so ABC and abc both convert to 2748.
Can I include the "0x" prefix? No. Enter only the digits themselves (for example 1A, not 0x1A), since the parser expects a plain base-16 string.
What is the largest number I can convert? The tool parses values as a 64-bit long, so it handles hex numbers up to 7FFFFFFFFFFFFFFF (9,223,372,036,854,775,807 in decimal) reliably.