Last updated
Quick Reference
- 1 hex digit = 4 binary digits = 4 bits
- 2 hex digits = 8 binary digits = 1 byte
- 4 hex digits = 16 binary digits = 2 bytes (word)
- 8 hex digits = 32 binary digits = 4 bytes (dword)
- 16 hex digits = 64 binary digits = 8 bytes (qword)
- 0xFF = 255 decimal = 1111 1111 binary
- 0x00 = 0 decimal = 0000 0000 binary
- 0x80 = 128 decimal = 1000 0000 binary
All conversions happen instantly in your browser. Paste hex values, binary strings, or upload data for batch conversion — no server required.
Examples
Example 1: Basic Hex to Binary Conversions
Each hex digit maps to exactly 4 binary digits. This 1:4 relationship is the key to understanding both systems.
Hex → Binary conversion table:
0 → 0000 8 → 1000
1 → 0001 9 → 1001
2 → 0010 A → 1010
3 → 0011 B → 1011
4 → 0100 C → 1100
5 → 0101 D → 1101
6 → 0110 E → 1110
7 → 0111 F → 1111
Examples:
FF → 1111 1111
A0 → 1010 0000
1F → 0001 1111
7E → 0111 1110
0x2A → 0010 1010
0xFF → 1111 1111
Example 2: Multi-Byte Hex to Binary
Convert hex color code to binary:
#FF5733 → FF 57 33
FF → 1111 1111 (Red channel: 255)
57 → 0101 0111 (Green channel: 87)
33 → 0011 0011 (Blue channel: 51)
Full binary: 1111 1111 0101 0111 0011 0011
---
Convert IPv4 address to binary:
192.168.1.1
192 → 0xC0 → 1100 0000
168 → 0xA8 → 1010 1000
1 → 0x01 → 0000 0001
1 → 0x01 → 0000 0001
Binary: 11000000.10101000.00000001.00000001
---
Convert a 2-byte value:
0x1A2B → 0001 1010 0010 1011
Example 3: Binary to Hex Conversion
Group binary digits into sets of 4 from the right, then convert each group:
1010 1100 → AC
0001 1111 → 1F
1111 0000 → F0
Longer example:
1101 0011 1010 0101
D 3 A 5
→ 0xD3A5
Odd number of bits — pad left with zeros:
101 1010 → 0101 1010 → 5A
---
// JavaScript: convert binary string to hex
const binary = '11010011';
const hex = parseInt(binary, 2).toString(16).toUpperCase();
console.log(hex); // D3
// Convert hex to binary
const hexVal = 'D3';
const bin = parseInt(hexVal, 16).toString(2).padStart(8, '0');
console.log(bin); // 11010011