Hexadecimal to Binary Converter – Free

Type a base-16 number and this hex to binary converter returns the same value in base 2. For example, 2d becomes 101101 and FF becomes 11111111.

How to use the Hexadecimal to Binary tool

  1. Enter the hexadecimal number in the Base-16 number box, for example 2d. A 0x prefix is allowed.
  2. Select Convert to expand it to binary.
  3. Read the bits in the Result box. Leading zeros are dropped, so the first digit is always 1 unless the value is 0.
  4. Select Copy to copy the bits. Pad on the left to a multiple of four or eight if you need whole nibbles or bytes.

How hex to binary conversion works

Sixteen is two to the fourth power, so one hexadecimal digit always corresponds to exactly four binary digits. Conversion is a lookup: replace each hex digit with its 4-bit pattern and join the groups. No division is needed, which is why hex is the usual shorthand for binary.

0 = 0000   4 = 0100   8 = 1000   C = 1100
1 = 0001   5 = 0101   9 = 1001   D = 1101
2 = 0010   6 = 0110   A = 1010   E = 1110
3 = 0011   7 = 0111   B = 1011   F = 1111

Worked example and the missing leading zeros

Take A5. A is 1010 and 5 is 0101, so A5 is 10100101. For 2D, the lookup gives 0010 1101. The tool then prints 101101, because it treats the input as a number and numbers do not carry leading zeros.

If the bits feed a register map or a byte-oriented protocol, restore the padding: add zeros on the left until the length is four times the number of hex digits.

A5     ->  10100101
2d     ->  101101            (0010 1101 without its leading zeros)
0F     ->  1111
CAFE   ->  1100101011111110
0x1F4  ->  111110100

Accepted input formats

The Base-16 number box takes a single hexadecimal whole number, written as follows. It is converted on your device and never uploaded.

One quirk to know: 0b is not a binary prefix in this field. Since b is a hex digit, 0b1 is read as hex B1 and converts to 10110001.

  • Digits 0 to 9 and letters A to F in either case.
  • An optional 0x prefix, and an optional minus sign before it. -0x1A converts to -11010.
  • Up to 4,096 characters in total.
  • No spaces between digits, no # or h markers and no fractional part. Each of these is reported as an invalid base-16 digit.

Where hex to binary helps

Datasheets give register values and bit masks in hex, but the meaning sits in individual bits. Expanding 0x3C to 111100 shows at once that bits 2 through 5 are set. The same goes for CPU flags, file permission masks, IPv6 address groups, color channels and instruction encodings when you are reading a disassembly.

Frequently asked questions

What is 2D in binary?

2D is 101101. Digit by digit it is 0010 1101, and the converter drops the two leading zeros. The value is 45 in decimal.

What is FF in binary?

FF is 11111111, eight ones, the largest value of an unsigned byte. FFFF is sixteen ones.

Why is my result not a multiple of four bits long?

The converter outputs the numeric value without leading zeros. A first hex digit below 8 starts with one or more zero bits, and those are omitted. Pad the result on the left to restore full nibbles.

Can I convert a string of hex bytes with spaces?

No. This tool reads one number, and a space is reported as an invalid digit. Remove the spaces to convert the bytes as a single large number, keeping in mind that leading zeros of the first byte are dropped.

Does it handle negative hex numbers?

It accepts a leading minus sign and returns a minus sign with the binary magnitude. It does not interpret FF as -1. Signed meaning depends on a word size that a bare hex string does not state.

How large a hex value can I convert?

The input can be up to 4,096 characters, which is more than 16,000 bits. The conversion uses arbitrary-precision integers, so a 256-bit key or hash converts exactly.

Related tools