Skip to content
Deftkit

Hex to Binary Converter — Instant Hexadecimal to Base-2

Convert hexadecimal numbers to binary instantly. Each hex digit maps to 4 bits. Free, runs entirely in your browser, zero dependencies.

Input base
Try a preset
All bases
Binary
0b1111 1111
Octal
0o377
Decimal
255
Hex
0xFF
Bit width: 8 bits
Byte width: 1 byte
Fits in: uint8 / int8

Supports arbitrary-precision integers via BigInt — no 2⁵³ overflow. Handles negative numbers and the standard 0b/0o/0x prefixes. All conversion happens in your browser.

Converting hex to binary, explained

Hexadecimal (base 16) and binary (base 2) are closely related: each hex digit corresponds to exactly 4 binary digits (one nibble). That neat mapping makes hex-to-binary conversion faster than any other base conversion — you just expand each hex character into its 4-bit binary equivalent and concatenate. This hex to binary converter does the expansion instantly in your browser with arbitrary precision, so a 64-character SHA-256 digest converts to its 256-bit binary form as easily as a one-character hex value.

The nibble lookup table

Every hex digit maps to exactly 4 bits:

Hex  Binary     Decimal
0    0000       0
1    0001       1
2    0010       2
3    0011       3
4    0100       4
5    0101       5
6    0110       6
7    0111       7
8    1000       8
9    1001       9
A    1010       10
B    1011       11
C    1100       12
D    1101       13
E    1110       14
F    1111       15

To convert a multi-digit hex number, replace each digit with its 4-bit binary equivalent and concatenate. For example, 3F becomes 0011 1111, and A7E becomes 1010 0111 1110.

How to use this hex to binary converter

  1. Type or paste a hexadecimal number into the hex field. Upper or lowercase works; 0x prefix is optional.
  2. The binary field updates live with the base-2 equivalent. Decimal and octal also appear for reference.
  3. Output is the minimum bit string with no leading zeros — F becomes 1111, not 00001111. Pad manually if you need a fixed bit width.
  4. Invalid characters (anything outside 0-9, A-F) surface an inline error.

Examples

Hex       Binary
0         0
1         1
A         1010
F         1111
10        10000
FF        11111111       # one byte
1F        11111
ABCD      1010101111001101
DEADBEEF  11011110101011011011111011101111

When you actually need hex to binary

  • Reading a register layout. Datasheets show register bits in binary; the value you have is in hex (from a memory read). Expanding to binary lets you see which bits are set.
  • Debugging bit fields. A protocol header is a hex value; you need to know whether bit 5 is set. Expand to binary and count.
  • Understanding masks and flags. 0x0F as a mask is 00001111 — the low nibble.
  • Reading disassembly. Instruction opcodes are shown in hex; the decoding tables are in binary.
  • Teaching number systems. The hex-to-binary mapping is the cleanest way to introduce base conversions because there is no arithmetic involved — just a lookup.

Why hex and binary map so cleanly

Hex is base 16, which equals 2^4. Because 16 is a power of 2, every hex digit corresponds to exactly 4 bits with no remainder. Base conversions between non-power-of-2 bases (like decimal to binary) require repeated division; conversions between a base and a power of it are pure digit substitution. This is also why hex is preferred over decimal for expressing binary data compactly: every byte is exactly 2 hex digits, every 32-bit word is 8 hex digits, and so on. Octal (base 8 = 2^3) has the same property, which is why it was common in the era of 12-bit, 18-bit, and 36-bit word sizes.

Privacy

This hex to binary converter runs entirely in your browser. Conversion happens locally via JavaScript BigInt. No data leaves your device — safe for register values, keys, or any sensitive bit pattern you are debugging.

Frequently asked questions

Does the binary output have leading zeros?

No. The tool outputs the minimum bit string, so F becomes 1111, not 00001111. If you want each hex digit padded to its full 4 bits, pad the hex input with a leading zero (e.g. convert 0F instead of just F to get 1111 with a leading 0 group).

Can I paste a SHA-256 hash and convert it?

Yes. The tool uses BigInt, so a 64-character hex hash converts to a 256-bit binary string correctly. That binary form is rarely useful for people but can help when verifying bit-level properties of a digest.

How do I convert hex to binary by hand?

Memorize the 16-entry nibble table (shown above). Replace each hex digit with its 4-bit binary equivalent and concatenate. No arithmetic required — it is pure lookup.

How do I convert hex to binary in code?

JavaScript: parseInt(hex, 16).toString(2) for small values; BigInt('0x' + hex).toString(2) for large ones. Python: bin(int(hex, 16)). C: use printf or an inline lookup table.

Why not just work in binary directly?

Binary strings are 4× longer than hex and harder to read at a glance. Hex is preferred for storage, display, and communication; binary is used only when bit-level detail matters (flags, bitfields, low-level hardware). Converting hex → binary is typically a temporary inspection step.