Hex Converter: Simple & Powerful

Instructions:
  • Select the conversion type from the dropdown menu
  • Enter the value you want to convert (without prefixes like 0x)
  • For hexadecimal: use 0-9 and A-F (case insensitive)
  • For binary: use only 0 and 1
  • For octal: use only 0-7
  • For decimal: use 0-9 (integers only)

Ten conversion pairs, one input box

Rather than separate pages for each pair of bases, this tool exposes ten conversion directions (hex↔decimal, hex↔binary, decimal↔binary, binary↔hex, hex↔octal, decimal↔octal, octal↔decimal, octal↔hex) through one dropdown. It validates the input against the character set of the selected source base before converting — a value with a "G" won't pass hex validation, and an "8" won't pass octal validation, since octal only uses digits 0-7.

Worked example: hexadecimal to decimal

Select Hexadecimal → Decimal and enter 1F. Position 0 (rightmost) holds F = 15, multiplied by 16⁰ = 1, giving 15. Position 1 holds 1, multiplied by 16¹ = 16, giving 16. Sum: 15 + 16 = 31. The tool's step display shows this exact digit-by-digit breakdown before totaling.

Worked example: decimal to hexadecimal

Select Decimal → Hexadecimal and enter 255. Repeated division by 16: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F). Reading the remainders from the last division to the first gives FF. This is a useful value to know by heart since 255 is the maximum for a single byte (2⁸ - 1), and FF is exactly how that maximum is written in hex — the reason white is #FFFFFF in web colors.

Why hex, octal, and binary all relate cleanly to each other

Binary, octal, and hexadecimal are all powers of 2 (2¹, 2³, 2⁴), so digits group evenly: one octal digit maps to exactly 3 binary digits, one hex digit maps to exactly 4. Decimal (base 10) doesn't share this property with binary, which is why decimal↔binary and decimal↔hex conversions in the code go through explicit repeated-division arithmetic instead of simple digit grouping.

Constraints

The tool does not auto-detect which base you typed — you must select the correct source base from the dropdown, or the validation check will reject valid-looking input (e.g., typing "19" while "Binary → Decimal" is selected fails because 9 isn't a valid binary digit).