Free Online Tool Updated August 2026

Hex to Binary Converter — How to Convert Hexadecimal to Binary.

Convert hex to binary instantly with our free online calculator, or learn how hexadecimal numbers are represented and converted to bits by hand using the 4-bit digit expansion algorithm. Includes a complete hexadecimal conversion table, worked step-by-step mathematical examples, and code snippets in Python, JavaScript, and Bash.

Try it: Hex to Binary Converter

Binary Result: 00101010
Popular Conversions (Click to test):

Hex to Binary Table & Popular Conversion Matrix

Below is an instant lookup table answering top search queries like 0xd in binary, 0x50 to binary, and 0x20 in binary. Click any row to load the exact bit conversion into the calculator above.

Hex Query Binary (4-bit / 8-bit) Decimal Meaning / Note
1101 (00001101) 13 Hex D maps to bits 1101
00100000 32 ASCII Space character
01010000 80 ASCII Uppercase letter 'P'
1100 (00001100) 12 Hex C maps to bits 1100
11111111 255 Maximum unsigned 8-bit byte
00000000 0 Null byte / Zero value
0100 (00000100) 4 Hex 4 maps to bits 0100
1000 (00001000) 8 Hex 8 maps to bits 1000
1011 (00001011) 11 Hex B maps to bits 1011
1111 (00001111) 15 Hex F maps to bits 1111
00010100 20 Hex 14 = 16 + 4 = 20
000110100011 419 3-nibble sequence: 1, A, 3

What is hexadecimal to binary conversion?

Hexadecimal (hex, base-16) is a number system that uses 16 symbols: digits 0–9 represent values zero through nine, and letters A–F represent values ten through fifteen. Binary (base-2) uses only two symbols: 0 and 1. Binary is the native language of computers, but it produces very long strings of digits that are hard for humans to read.

Hex exists specifically as a shorthand for binary. Since 16 = 2⁴, each single hex digit maps to exactly four binary digits (bits). This makes conversion between hex and binary a simple one-to-one substitution — no complex arithmetic is needed. This is why programmers, hardware engineers, and network analysts use hex to represent memory addresses, color codes (like #FF5733), MAC addresses, and binary data dumps.

For the reverse conversion, see our binary to hexadecimal converter. You can also convert hex to decimal or hex to ASCII text.

Hex to Binary Formula & 4-Bit Expansion Method

Follow these steps to convert any hexadecimal value to binary:

  1. Separate each hex digit. Process each character from left to right.
  2. Replace each digit with its 4-bit binary equivalent using the mapping table below. For digits 0–9, convert normally. For A–F, use: A=1010, B=1011, C=1100, D=1101, E=1110, F=1111.
  3. Concatenate all the 4-bit groups in the same order.
  4. Optionally strip leading zeros from the leftmost group.

This works because each hex digit can hold values 0–15 (16 values), and 4 binary digits can also represent exactly 16 values (0000–1111). The relationship is a perfect mathematical fit.

Hexadecimal to Binary Conversion Examples with Steps

Example 1: Convert hex 2A to binary

  • Separate digits: 2 and A
  • 2 ➔ 0010
  • A (decimal 10) ➔ 1010
  • Combine: 0010 + 1010 = 00101010 (or 101010)

Example 2: Convert hex FF to binary

  • Separate digits: F and F
  • F (decimal 15) ➔ 1111
  • F (decimal 15) ➔ 1111
  • Combine: 11111111 (decimal 255 — the max value of one byte)

Example 3: Convert hex 1A3 to binary

  • Separate digits: 1, A, 3
  • 1 ➔ 0001
  • A (decimal 10) ➔ 1010
  • 3 ➔ 0011
  • Combine: 000110100011 (or 110100011, decimal 419)

Example 4: Convert hex 0.C to binary (fractional)

  • Integer part: 00000
  • Fractional part: C (decimal 12) ➔ 1100
  • Combine with radix point: 0.1100 (decimal 0.75)

Example 5: Convert hex color #3291FF to binary

  • 3→0011, 2→0010, 9→1001, 1→0001, F→1111, F→1111
  • Combine: 001100101001000111111111
  • R=00110010 (50), G=10010001 (145), B=11111111 (255)

Example 6: Convert 0xd to binary (Hex to bits)

In programming, the prefix 0x denotes a hexadecimal number. When converting 0xd to binary (hex to bits), we convert the digit d (which represents decimal 13):

  • Digit D ➔ 1101
  • Therefore, 0xd to binary converts to 1101 (or 8-bit padded: 00001101)

Fractional Hex to Binary Representation

In computing, we often need to represent fractional values in different base systems. Converting a hex fraction to its binary equivalent follows the same 4-bit digit expansion method. This simple translation is a core feature of the base-16 numeral system, enabling programmers to inspect memory storage layouts without performing complex arithmetic division.

To express a hex fraction like 0.8C:

  • Keep the radix point (decimal point) in its corresponding position: 0.
  • Convert the first fractional digit 8 to 4-bit binary: 1000.
  • Convert the second fractional digit C (decimal 12) to 4-bit binary: 1100.
  • Combine them after the point to get the fractional binary string: 0.10001100.

Using this digit expansion, any floating-point hex value can be expressed as a fractional binary number by converting each hexadecimal digit to its 4-bit equivalent.

Hex to binary in programming languages.

Here's how to convert hex to binary programmatically. For more examples, see our developer code snippets page.

Python 3
# Convert hex string to binary string
hex_str = "2A"
binary_str = bin(int(hex_str, 16))[2:]
print(binary_str)  # Output: 101010

# With leading zeros (8-bit padded)
binary_8bit = bin(int(hex_str, 16))[2:].zfill(8)
print(binary_8bit)  # Output: 00101010

# Digit expansion method
binary = "".join(f"{int(d, 16):04b}" for d in "FF")
print(binary)  # Output: 11111111
JavaScript
// Convert hex to binary
const hex = "2A";
const binary = parseInt(hex, 16).toString(2);
console.log(binary); // Output: 101010

// With zero-padding to 8 bits
const padded = parseInt(hex, 16).toString(2).padStart(8, "0");
console.log(padded); // Output: 00101010
Bash / Linux CLI
# Using bc to convert hex 2A to binary
echo "obase=2; ibase=16; 2A" | bc
# Output: 101010

# Using Python one-liner
python3 -c "print(bin(0x2A)[2:])"
# Output: 101010

Hex to 8-bit, 16-bit, and 32-bit Binary Reference

The most common bit widths used in computer systems are 8-bit (one byte), 16-bit (one word), and 32-bit (one double-word). Here are frequently referenced hex values at each width:

Hex Dec 8-bit Binary 16-bit Binary
0000000 00000000 0000 0000 0000
0110000 00010000 0000 0000 0001
0A100000 10100000 0000 0000 1010
0F150000 11110000 0000 0000 1111
10160001 00000000 0000 0001 0000
1A260001 10100000 0000 0001 1010
2A420010 10100000 0000 0010 1010
3F630011 11110000 0000 0011 1111
40640100 00000000 0000 0100 0000
7F1270111 11110000 0000 0111 1111
801281000 00000000 0000 1000 0000
A01601010 00000000 0000 1010 0000
C01921100 00000000 0000 1100 0000
D32111101 00110000 0000 1101 0011
FE2541111 11100000 0000 1111 1110
FF2551111 11110000 0000 1111 1111
FF FF655351111 1111 1111 1111

For 32-bit values, simply pad the 16-bit binary with 16 leading zeros. For example, hex 0000 00FF becomes 00000000 00000000 00000000 11111111 in 32-bit binary.

Common mistakes when converting hex to binary.

Even with the simple digit-expansion method, these mistakes trip up beginners:

1. Forgetting to zero-pad to 4 bits

Hex 3 does not convert to just 11 — it must be 0011. Every hex digit always produces exactly 4 binary digits. Skipping the leading zeros causes errors when concatenating multiple digits.

2. Mixing up letter cases (A–F vs a–f)

Hex digits are case-insensitive: a and A both equal decimal 10 (binary 1010). However, if you are processing a hex string in code without normalizing case first, your lookup table may return wrong results.

3. Treating the entire hex number as one big decimal

A common error is to interpret hex 1A as decimal 1A (not a valid decimal), then try to convert that to binary. Instead, process each hex digit independently: 1→0001 and A→1010, giving 00011010.

4. Stripping leading zeros from intermediate groups

You may strip the leading zeros from the final result, but never from an intermediate group. Converting hex A0: A→1010, 0→0000. Result: 10100000. If you strip 0's zero-group to nothing, you get the wrong answer 1010.

Why programmers use hex instead of binary.

Raw binary is the language computers actually speak, but it becomes impractical for humans to read at any length. A 32-bit value in binary is 32 digits of zeros and ones. The same value in hex is just 8 characters. This 4-to-1 compression is what makes hex the universal notation for:

  • Memory addresses and pointers — e.g., 0x7FFE4B2A0000 instead of 48 binary digits
  • Color codes in CSS and graphics#FF5733 encodes R, G, B as three 8-bit values
  • Network and MAC addresses — e.g., 00:1A:2B:3C:4D:5E
  • Bytecode and machine code listings — debuggers and disassemblers display instructions as hex opcodes
  • File format signatures (magic bytes) — e.g., PNG files start with 89 50 4E 47
  • Cryptographic hashes and keys — SHA-256 produces 64 hex characters (256 bits)

Because of the perfect 4:1 relationship between hex and binary digits, programmers can instantly convert between the two mentally without needing any arithmetic — which is why this skill is taught in every computer science curriculum.

Frequently Asked Questions

How do you convert hex to binary?

Replace each hex digit with its 4-bit binary equivalent (0=0000 through F=1111), then concatenate all the groups in order. This works because hexadecimal is base-16 and 16 = 2⁴, so each hex digit maps to exactly four binary bits.

What is the binary of hex FF?

Hex FF = binary 11111111. Each F expands to 1111, so FF = 1111+1111 = 11111111. In decimal, this equals 255, which is the maximum value that can be stored in a single 8-bit byte.

How do you convert hex to 8-bit binary?

First convert the hex value to binary using the 4-bit expansion method, then pad with leading zeros until you reach 8 bits. For example, hex 0A expands to 0000 1010, which is already 8 bits. Single hex digits like 5 expand to 0101, so pad to 00000101 for 8-bit representation.

What is the difference between hexadecimal and binary?

Binary (base-2) uses only 0 and 1 — it's how computers store data internally. Hexadecimal (base-16) uses 0–9 and A–F — it's a compact way for humans to read binary data. One hex digit represents exactly 4 binary digits. For example, the binary sequence 11111111 (8 digits) can be written as just FF in hex (2 digits).

What is hex C in binary?

Hex C represents decimal 12. In binary, 12 = 1100. You can verify: 1×8 + 1×4 + 0×2 + 0×1 = 12.

How do you convert a hex string to binary in code?

In Python: bin(int("FF", 16))[2:] returns "11111111". In JavaScript: parseInt("FF", 16).toString(2) returns the same. Both parse the hex string to an integer, then convert that integer to a binary string. See the code examples above for more detail.

Hex → Binary Mapping

Hex Dec 4-Bit Binary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Explore Other Popular Converters