RevealTheme logo

Hex to Binary Converter

Convert a hexadecimal value to binary right in your browser. Each hex digit expands to exactly 4 binary digits, and the result is grouped into space-separated nibbles.

How to use this tool

  1. 1

    Type or paste a hex value into the input box, for example 1A2B or 0x1A2B.

  2. 2

    An optional leading 0x and any spaces are removed automatically before conversion.

  3. 3

    Read the binary result below the box, shown as 4-bit groups separated by spaces.

  4. 4

    If the box stays empty, check your input contains only the digits 0-9 and letters A-F.

What is hexadecimal-to-binary conversion?

Hexadecimal (base 16) and binary (base 2) are both ways of writing the same numbers, and converting between them is a fixed digit-by-digit substitution. Because 16 is 2 to the fourth power, every single hex digit maps to exactly one group of four binary digits, called a nibble: 0 becomes 0000, 9 becomes 1001, A becomes 1010, and F becomes 1111. This clean alignment is why hex is so popular for writing out binary data compactly. To convert, you replace each hex digit with its 4-bit pattern and concatenate the results; no arithmetic on the whole number is needed. This tool does exactly that. It first strips an optional leading 0x and removes any whitespace, then checks the remaining text against the digits 0-9 and the letters a-f or A-F. If the string is valid, each character is converted with parseInt(digit, 16) and padded to 4 bits, then the nibbles are joined with spaces for readability. Note that it treats the input purely as a sequence of hex digits, so it does not handle signed values, a minus sign, fractional points, or 0b-style prefixes; anything outside 0-9 and A-F simply produces no output.

Common use cases

  • Decoding a hex color like FF8800 into its red, green, and blue bit patterns when working on a design or shader.

  • Inspecting the binary layout of a memory address or register value printed by a debugger.

  • Teaching or learning how each hex digit corresponds to a 4-bit nibble in a computer-science class.

  • Checking the bit pattern of a hardware flag or bitmask defined in hex in firmware or driver code.

  • Translating a hex opcode or byte from a disassembly into binary to read individual instruction fields.

  • Verifying that a hex constant in a config file expands to the bit pattern you expect before committing it.

Frequently asked questions

Does it accept a 0x prefix?
Yes. A single leading 0x or 0X is stripped before conversion, so both 1A2B and 0x1A2B give the same result. The prefix is only removed at the very start of the string.
What happens to spaces in my input?
All whitespace is removed before conversion, so you can paste values like 1A 2B 3C and they will be treated as one continuous hex string.
Why is the output blank?
The tool only converts when every remaining character is a valid hex digit (0-9, a-f, A-F). Any other character, such as a minus sign, a decimal point, or the letter G, makes the input invalid and produces no output.
Why is the result grouped into 4-bit chunks?
Each hex digit always maps to exactly 4 binary digits, so grouping by nibble keeps the binary visually aligned with the original hex. The groups are separated by spaces purely for readability.
Can it convert negative or fractional hex values?
No. It treats the input as a plain sequence of hex digits, so a minus sign or a fractional point is rejected as invalid. For signed or floating-point conversions you would need a dedicated numeric tool.
Is there a length limit?
There is no fixed limit imposed by the tool; it processes each digit independently, so even long hex strings convert. Very large inputs are handled as text rather than as a single number.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser with JavaScript. Nothing you type is sent to a server, so your input never leaves your device.

Related tools