Binary to Hex Converter: Step-by-Step With Nibbles
Guides

Binary to Hex Converter: Step-by-Step With Nibbles

hsr882026-08-21 · Updated 2026-10-2512 min read
binary to hexhex to binarybinary to hex converternibbleconvert binary to hexadecimal

Four binary bits correspond to one hexadecimal digit. Grouping bits this way lets you convert directly between binary and hex without calculating a decimal value first. Below are the 16 possible groups, followed by worked examples and a practice set.

Why Hex Maps Cleanly to Binary

Because 16 equals 2⁴, every hex digit corresponds to four bits. Decimal digits have no fixed grouping of binary bits, so decimal conversion uses a different method.

Programmers write colors as #FF8800, memory addresses as 0x7FFE, and machine opcodes as hex for the same reason: compact, aligned with bytes, easy to eyeball. For a broader comparison, see hexadecimal vs binary.

The Nibble Table (Memorize This)

A nibble contains four bits and has 16 possible values. Use this table to replace each group with its hex digit.

HexBinaryDecimalHexBinaryDecimal
000000810008
100011910019
200102A101010
300113B101111
401004C110012
501015D110113
601106E111014
701117F111115

Tip: A-F are just 10-15. C is 12, which is 1100 (two high bits). Patterns like that stick after a few conversions.

Binary to Hex: Group by Fours

Write the bits. Pad on the left with zeros so the length is a multiple of 4. Split into nibbles. Replace each nibble with the hex digit from the table.

Example: convert 1101011011

  1. Pad: 0011 0101 1011
  2. Lookup: 0011→3, 0101→5, 1011→B
  3. Result: 0x35B

Another one: 11111111 → 1111 1111 → FF. That is a full byte set to all ones, common in masks and “no value” sentinels.

Hex to Binary: Expand Each Digit

Replace each hex digit with its four-bit binary equivalent. Keep leading zeros within each group so the boundaries stay intact.

Example: convert 0xA7

  1. A → 1010
  2. 7 → 0111
  3. Concatenate: 10100111

The same method works for hashes and MAC addresses: expand every hex digit into four bits. For long strings, a converter reduces transcription errors.

Bytes: Two Hex Digits, Eight Bits

One byte = two hex digits = eight bits. That is why hex dumps print spaces every two digits, and why ASCII codes are often written as 0x41 for ‘A’.

CharDecimalHexBinary
A654101000001
a976101100001
0483000110000
space322000100000

Cross-check against the ASCII table or encode a string with text to binary, then convert those bytes to hex with the nibble method.

Worked Example: Color Code

CSS color #4F46E5 (indigo-ish) expands as:

4 → 0100

F → 1111

4 → 0100

6 → 0110

E → 1110

5 → 0101

01001111 01000110 11100101

Three bytes: R=79, G=70, B=229 in decimal if you care about channel math.

Common Mistakes

Leading zero padding preserves an unsigned value while fixing its width. For example, 1011 and 00001011 both equal decimal 11. The eight-bit form is written as 0x0B in hex.

Mixing up bit order inside a nibble is rare if you always write MSB on the left (standard). Mixing up byte order in multi-byte integers is common; that is endianness, not nibble conversion. See the hex dump guide (or hex viewer) when dumps look “byte swapped.”

Writing G as a hex digit is invalid. Valid digits stop at F.

When Decimal Still Helps

Mental math for small values is fine: 0x10 is 16, 0x100 is 256. For bit masks and flags, stay in hex/binary. For “how many items fit in this buffer,” decimal is clearer.

Floating-point bit patterns are a different animal. Those need the IEEE 754 tool, not nibble substitution alone.

Practice Set

Convert without a calculator, then verify:

  • 10101100 → hex? (answer: AC)
  • 0x3E → binary? (answer: 00111110)
  • 111100001111 → hex? (answer: F0F)

FAQ

Do I need spaces between nibbles?

Only for readability. 11110000 and 1111 0000 are the same value. Tools usually accept either.

Is 0x the same as h or $ prefixes?

Same idea, different dialects. C and JavaScript use 0x. Some assemblers use $ or a trailing h. The digits after the prefix are still hex.

How do I convert binary text messages to hex?

Decode to text first with binary to text, or treat each 8-bit group as a byte and map two nibbles to two hex digits. Both paths agree if the bit grouping is correct.

Can octal use the same nibble trick?

Octal groups three bits (2³ = 8), not four. Related but different. Read octal explained for Unix permission math.

Convert Faster Online

The nibble method is worth knowing cold for interviews and debugging. For long payloads, let software do the typing.

Use the Binary Converter to flip between binary, hex, decimal, and octal. The home page also wires text encoding if your bits came from a string. More practice examples live in binary code examples.

Check the examples

Technical reference

Related Articles

Try the free converters