Convert Hexadecimal to Binary

Convert hexadecimal to binary by expanding each hex digit into 4 bits. Includes the full nibble mapping table and practical conversion examples for developers.

Hexadecimal (Base 16)Binary (Base 2)Conversion

Detailed Explanation

Converting hexadecimal to binary is the inverse of binary-to-hex and is just as straightforward. Each hex digit expands to exactly 4 binary bits, making the process purely mechanical.

Step-by-step example — converting 0xA7E2 to binary:

  1. Take each hex digit individually: A, 7, E, 2
  2. Convert each to its 4-bit binary equivalent:
    • A = 1010
    • 7 = 0111
    • E = 1110
    • 2 = 0010
  3. Concatenate: 1010 0111 1110 0010

So 0xA7E2 = 1010011111100010₂.

Why hex-to-binary is so direct:

The beauty of hexadecimal is that it was designed as a shorthand for binary. Since 16 = 2⁴, every hex digit maps to a unique 4-bit pattern. There is no arithmetic involved — just a simple lookup. This is why hex became the universal standard for displaying binary data in computing.

Practical applications:

  • Reading machine code: Disassemblers show instructions in hex. Converting to binary lets you see individual opcode bits and addressing modes.
  • Analyzing network packets: Protocol fields are shown in hex in tools like Wireshark. Converting to binary reveals individual flag bits.
  • Understanding permissions: Unix file permissions in hex (like 0x1FF) become clear when viewed as binary (111111111), showing read/write/execute bits.
  • Color manipulation: Hex color #FF8040 becomes 11111111 10000000 01000000 in binary, which helps when performing bitwise color operations.

Tips for speed:

Memorize the binary equivalents for hex digits 0-F. Focus especially on 0=0000, 5=0101, A=1010, and F=1111, as these appear most frequently. With practice, you can convert a 32-bit hex value to binary in seconds by mentally expanding each digit.

Use Case

Security researchers expand hex-encoded shellcode into binary to analyze individual instruction bits and identify exploit techniques in malware samples.

Try It — Number Base Converter

Open full tool