TOP

Free browser converter

Hex to Binary Converter

Convert hexadecimal digits to binary bits in your browser with explicit ASCII, Unicode code point, and UTF-8 byte handling.

No signupFree online conversion

Interactive tool

Convert hexadecimal digits to binary bits

Ready

Mode and output format

Choose the exact representation you need; the tool does not guess an encoding.

Detailed conversion guide

How to Convert Hex to Binary

Hexadecimal uses sixteen digits, so every hex digit maps exactly to four binary bits. Hex 2 becomes 0010, F becomes 1111, A becomes 1010, and 0 becomes 0000.

The converter maps digits directly rather than passing through a floating-point number. That preserves leading zeros and works for inputs longer than JavaScript's safe integer range.

InputOutputMeaning
00000one nibble
A1010one nibble
F1111one nibble
2F0010 1111two nibbles

Hex to Binary in JavaScript and Python

For exact formatting, convert each hexadecimal digit to a four-bit string. Avoid Number for long inputs; direct nibble mapping or BigInt prevents precision loss.

// validate first, then convert
const value = Number.parseInt(token, radix);
if (!Number.isInteger(value)) throw new Error("Invalid input");

Leading Zeros, Grouping, and Invalid Hex

Compact output joins all bits. Four-bit output keeps the natural hex nibble boundary, while eight-bit output left-pads to a full byte when needed.

Only digits 0-9 and A-F are valid. Prefixes and separators are syntax; any other character produces a warning instead of a partial conversion.

Related converters

Choose the converter for the direction and representation you need.

Advertisement

Sponsored link