Hex color palette with code editor, binary to hexadecimal conversion

Binary to Hex: Manual Conversion vs Online Translator

Binary and hexadecimal are two sides of the same coin. Every hex digit is exactly 4 bits. This makes converting between them fast once you learn the mapping. This guide covers the manual method, the lookup table you should memorize, and when an online binary-to-hex converter is the better option.

Why Hex Exists (and Why Programmers Prefer It)

Binary is hard to read. The byte 11111111 and the byte 11111110 look nearly identical at a glance. But one is 255 and the other is 254. In hex, that is FF vs FE — easy to spot the difference.

Hex is essentially shorthand. Every byte (8 bits) becomes two hex characters. Every 32-bit word becomes eight hex characters. You see hex in:

The 4-Bit Grouping Method

The manual method takes three steps:

  1. Split the binary string into groups of 4 bits, starting from the right
  2. Pad the leftmost group with leading zeros if it is shorter than 4 bits
  3. Convert each 4-bit group to its hex equivalent
Convert 11010111 to hex:
Step 1: Group from the right → 1101 0111
Step 2: Both groups are 4 bits, no padding needed
Step 3: 1101 = D, 0111 = 7
Result: D7
Convert 101001 to hex (note: 6 bits, not a multiple of 4):
Step 1: Group from the right → 10 1001
Step 2: Pad left group → 0010 1001
Step 3: 0010 = 2, 1001 = 9
Result: 29

The Only Table You Need: 4-Bit Binary to Hex

BinaryDecimalHexBinaryDecimalHex
000000100088
000111100199
001022101010A
001133101111B
010044110012C
010155110113D
011066111014E
011177111115F

Print this table and tape it to your monitor. After a week of using it, you will not need it anymore. The patterns are regular and your brain picks them up fast.

Manual Conversion: Pros and Cons

When manual conversion works

When manual conversion breaks down

Programmatic Conversion: One-Liners in Every Language

Every programming language has a built-in way to convert binary strings to hex. Here are the ones you will use most often:

// JavaScript
parseInt("11010111", 2).toString(16); // "d7"
# Python
hex(int("11010111", 2))  # '0xd7'
// C (using strtol)
long val = strtol("11010111", NULL, 2);
printf("%lx", val);  // d7
// Bash (using arithmetic expansion)
printf '%x\n' "$((2#11010111))"  # d7

Online Binary to Hex Converter: When Speed Matters

An online binary translator handles conversion in one paste. No console, no script file, no memorization needed. This matters when you are staring at a 200-line hex dump from Wireshark or a serial console and you need to extract a specific field right now.

Our BinTranslate binary-to-hex converter works in both directions. Paste binary, get hex. Paste hex, get binary and decimal and ASCII text. It shows all the representations side by side, which is what you actually want when troubleshooting.

Common Binary-to-Hex Conversion Pitfalls

Grouping from the wrong direction

Always group from the right, not the left. Grouping 101001 from the left gives 1010 01, which pads to 1010 0001 = A1. Grouping from the right gives 10 1001, pads to 0010 1001 = 29. The correct answer is 29. This mistake costs more debugging hours than any other single conversion error.

Forgetting hex letters are case-insensitive but convention matters

D7 and d7 represent the same value (215 decimal). In practice, uppercase is standard for hex dumps and memory addresses (0xFF). Lowercase is common in CSS colors (#ff5733). Both are valid. Do not mix cases within a single document; it makes it harder to scan.

Treating hex as decimal when reading it back

0x10 is 16, not 10. 0x64 is 100, not 64. This trips up beginners reading hex dumps. When you see hex digits, the rightmost column is 160 (ones), the next is 161 (sixteens), then 162 (two hundred fifty-sixes). This mirrors decimal but with base 16.

Binary-Hex-Decimal Quick Reference

BinaryHexDecimalReal-World Meaning
000010100A10Line feed character
000011010D13Carriage return
001000002032Space (most common byte)
001100003048Character '0'
010000014165Character 'A'
011111117F127DEL character
1000000080128Start of extended ASCII
11111111FF255Max byte, subnet broadcast
Convert binary to hex in one paste
Use the Binary to Hex Converter →