Hex to Binary Converter

Hex to Binary Converter. Drop your value into Hex Input and the Hex to Binary Converter instantly expands it into Binary Output. The fastest way to move a color from a print spec sheet into CSS is the cmyk to hex converter, which outputs a ready-to-use hex code.

Paste any base-16 value into this hex to binary converter and you get the matching string of 1s and 0s back as you type, with every nibble grouped so you can check it by eye. It is a free online tool for anyone who needs hexadecimal to binary results for debugging, electronics homework or reading a register dump, and the guide below shows exactly how the answer is built so you can do it by hand too.

How Hexadecimal to Binary Conversion Works

The whole method rests on one fact: each hex digit stands for exactly four binary digits. The hexadecimal system is a base-16 numeral system with 16 symbols, the decimal digits 0 to 9 plus the letters A to F for the values ten to fifteen. The binary numeral system is base-2, with only 0 and 1, which map neatly onto the on/off states of an electric signal. In mathematics the base (radix) of a system tells you how many symbols it uses, so hex has a radix of 16 and binary a radix of 2. Because 16 equals 24, one hex digit and one group of 4 binary digits are interchangeable, which is why programmers write bytes as two hex digits instead of eight bits.

The same 4-bit rule holds across computing and information technologies: computers store data in binary, and both this converter and a hand lookup expand hex to binary the same way, which is why people read that data in hex because it is shorter and far less error-prone. The binary system underneath stays the same whichever notation you pick, and programming languages from C to Python accept both, so low-level programming leans on them constantly.

That relationship is what makes converting hex to binary so mechanical, and converting numbers between the two bases never needs more than a table. You do not need long division or a calculator. You swap each symbol using a lookup table, then concatenate the groups in the same order. A group of four bits is called a nibble, which is half a byte, so one byte always becomes two hex digits and eight bits.

The positional system behind the table

Both notations are a positional system, where a digit's place decides its weight. In a binary number, the rightmost digit is worth 20, the next one 21, and so on, so every weight is a power of 2. Inside one nibble the four weights are 8, 4, 2 and 1, so every value from 0 to 15 is a sum of a few of those powers of 2:

$$N_{16} = \sum_{i} d_i \times 16^{i} \qquad \text{and} \qquad d_i = 8b_3 + 4b_2 + 2b_1 + b_0$$

Here di is a hex digit and b3 to b0 are its four bits. A hex digit like B equals 11, and 11 is 8 + 2 + 1, so its bits are 1011.

Hex to Binary Conversion Table

Keep this conversion chart handy. It lists all 16 hexadecimal digits with their 4 binary digits, the 4-bit binary equivalent and decimal value, which covers every possible input.

Hex to Binary Conversion Table
Hex digitBinary (8-4-2-1 bit weights)Decimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115

Notice that the table is not signed: it shows plain unsigned values, so the leading bit of a nibble is just another bit weight of 8, not a sign marker.

Hex to Binary Converter Method: Step by Step

This step-by-step guide shows how to convert hex to binary for any length of hexadecimal number, and the two conversion examples after it apply it. Follow it once with a pencil and the converter's output will make sense forever.

  1. Write down the hex number and strip any 0x prefix or leading # sign.
  2. Split it into single hex digits, working from the rightmost digit to the leftmost digit.
  3. Replace each hex digit with its four-bit binary equivalent from the table.
  4. Concatenate the groups in the original order, reading from left to right.
  5. Drop any leading zeros you do not need, or keep them if you want a fixed width such as 16 bits.

Worked example: B3D5 to binary

Take the hex value B3D5. Split it into B, 3, D and 5, then look each one up: B is 1011, 3 is 0011, D is 1101 and 5 is 0101. Joining the groups gives 1011 0011 1101 0101, which is 1011001111010101 once the spaces are removed. That is 16 bits, so the bit count is 16, and the decimal representation is 46,037.

You can confirm the decimal value with the place-value formula:

$$\text{B3D5}_{16} = 11 \times 16^{3} + 3 \times 16^{2} + 13 \times 16^{1} + 5 \times 16^{0} = 45{,}056 + 768 + 208 + 5 = 46{,}037$$

Example with leading zeros: 1A7

A three-digit value shows why padding matters. 1A7 becomes 0001 1010 0111. The first nibble starts with three zeros, so the shortest form is 110100111 (9 bits, decimal 423), while the padded form keeps all 12 bits. When a specification says the field is 12 bits wide, keep the zeros.

Hexadecimal to Binary Converter Tips and Common Mistakes

Hex looks simple, but a few habits cause nearly every wrong answer people report.

Digit alignment

Convert one digit at a time and never merge two digits. If you write 3D as 1101 and forget the 3, the whole string shifts. Line the groups up in columns under the original digits before you concatenate.

Partial bytes

A value like F is only four bits, not a full byte. If a protocol expects eight bits, pad the nibble on the left, so 0xF becomes 0000 1111. Pad on the left only, because a zero on the right changes the number.

Number system confusion

The symbols 0 and 1 are valid in hex and binary alike, so 101 could be either. Write the base as a subscript (10116 versus 1012) or use a 0x prefix, and use a quick check: convert the result back to hex and make sure it matches.

Checking a Subnet Mask in Hex with the Hexadecimal to Binary Converter

Dariusz is auditing a branch router whose export lists the mask on VLAN 40 as 0xFFFFFC00. The address plan says that VLAN is a /23, and he needs to know which of the two is wrong before anyone renumbers hosts.

He types FFFFFC00 into the converter and reads the hex to binary result in four-bit groups:

Checking a Subnet Mask in Hex with the Hexadecimal to Binary Converter
Hex byte pairBinaryOnes
FF1111 11118
FF1111 11118
FC1111 11006
000000 00000

Counting the ones gives 8 + 8 + 6 + 0 = 22, so the mask is a /22, not a /23. The 10 trailing zeros are host bits, which leaves 210 − 2 = 1,022 usable addresses instead of the 510 that a /23 provides. Under standard CIDR notation (RFC 4632), a /22 starting at 10.40.0.0 also swallows 10.40.2.0 and 10.40.3.0, so the second half of that block must not be assigned to another VLAN.

Next he reruns the check with the plan's value, 0xFFFFFE00, and the third byte pair FE becomes 1111 1110, which ends the run of ones one bit earlier. That confirms the documentation, not the router, describes a /23. Dariusz opens a change ticket to set the interface mask to 255.255.254.0, and flags 10.40.2.0/23 as free space in the address plan only after the change lands.

Using a Hex Converter in Real Work

Developers reach for a hex converter whenever a value is stored compactly but must be read bit by bit.

  • Memory addresses: expand 0x7F3C to 0111 1111 0011 1100 to see which address bits select a page or a word.
  • Register flags: a status byte of A6 is 1010 0110, so bits 7, 5, 2 and 1 are set; every bit flag is visible at a glance, which helps when several bit flags share one byte.
  • Network configuration: MAC addresses and IPv6 groups are hex, many protocols define fields as hex, and subnet masks are easiest to reason about in bits.
  • Color codes: HTML colors such as #1E90FF hold three bytes, one each for red, green and blue.
  • Character encoding: the ASCII letter H is 0x48, which is 0100 1000; Unicode code points work the same way, and any data encoding that stores text as hex follows suit.
  • Error codes: decode an error code such as 0x80 into bits (1000 0000) to see which condition flag fired during debugging.

Embedded systems and digital circuit design

In embedded systems you configure hardware by writing a hex value to a register, in digital circuit design you describe logic gate inputs as bit patterns, and FPGA work does the same with wider constants. Both are far easier when you can see the binary string a hex constant stands for, especially for bitwise operations such as masking and shifting.

Binary Converter Features: What This Tool Does

This binary converter is built for speed and accuracy. Type in the box, and the result updates live, so you see it as you type instead of waiting for a reload.

  • It converts on the fly, so no Convert button click is needed, though you can press the Convert button after pasting a long value.
  • It accepts the 0x prefix, so 0xFF and FF give the same answer.
  • Output is formatted output: binary grouped in nibbles, hex grouped in byte pairs.
  • It shows the decimal equivalents and the bit count beside the binary value.
  • A copy button puts the result on your clipboard, and everything runs in your browser, so nothing is uploaded.
  • It offers real-time, bidirectional conversion: swap modes to go from binary back to hex.

Since conversion is digit by digit, there is no practical length limit, and you can validate the answer by converting it back.

Hex to Binary Code Snippets

If you would rather embed a hex to binary converter tool in your own project than click through a page, most languages have it built in. Remember to pad each digit to four bits.

Python

value = "B3D5"
bits = bin(int(value, 16))[2:].zfill(len(value) * 4)
print(bits)  # 1011001111010101

JavaScript

const value = "B3D5";
const bits = parseInt(value, 16).toString(2).padStart(value.length * 4, "0");
console.log(bits); // 1011001111010101

Related Converters and Number Systems

Hex is one of several bases you meet together. The binary to hex converter reverses this page, grouping bits in fours from the right. Any hexadecimal converter built on the same lookup logic will also cover the other steps in the chain, such as a hex to decimal converter and a decimal to binary converter, and octal groups bits in threes. For text, a hex number such as 48 65 6C 6C 6F spells "Hello" in ASCII. Fractional values and negatives need extra rules: signed numbers use two's complement, where the leftmost bit marks a negative number.