bitlvl
EN

Hex to binary converter

Enter a hex value and see its bits, grouped in fours so each nibble lines up with the hex digit it came from.

How base conversion works

A number system's base (or radix) is how many digits it has. Decimal has ten (0–9), binary two (0 and 1), octal eight and hexadecimal sixteen (0–9 then A–F). The value of a written number is the sum of each digit multiplied by the base raised to the digit's position, counting from zero on the right.

So 1011 in binary is 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11, and FF in hex is 15×16¹ + 15×16⁰ = 240 + 15 = 255.

Converting from decimal to another base

  1. Divide the number by the target base and write down the remainder.
  2. Divide the quotient again, and keep going until the quotient is 0.
  3. Read the remainders from last to first. That is the number in the new base.

For 11 → binary: 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading upward: 1011. The converter above prints these steps for any number you enter.

Hex and binary are the same thing in disguise

Because 16 = 2⁴, every hex digit is exactly four binary digits (a nibble). To convert between them, replace each hex digit with its 4-bit pattern and vice versa. 0xBEEF = 1011 1110 1110 1111. Octal works the same way with groups of three bits. That is why programmers prefer hex: it is a compact way to write bit patterns.

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

Prefixes you will see in code

Most languages mark the base with a prefix: 0x1F for hex, 0b11111 for binary, 0o37 (or a leading 0 in C) for octal. This converter accepts all of them, and also ignores spaces, underscores and commas, so 1111_1111 and 1111 1111 both work.

Examples

255 in binary, octal and hex
1111 1111 · 377 · FF
0xDEADBEEF in decimal
3,735,928,559
1 000 000 in hex
0xF4240
−42 in hex
−2A (as a signed magnitude; for the two's-complement bit pattern use the two's complement tool)

Questions

How do I convert hex to binary?

Replace each hex digit with its 4-bit binary pattern: 0 = 0000 … 9 = 1001, A = 1010, B = 1011, C = 1100, D = 1101, E = 1110, F = 1111. 0x2F becomes 0010 1111.

How do I convert binary to hex?

Group the bits in fours from the right (pad the left with zeros), then replace each group with its hex digit. 101111 → 0010 1111 → 2F.

Why do programmers use hexadecimal?

One hex digit is exactly four bits, so a byte is always two hex digits. Memory addresses, colour codes, hashes and bit flags are easier to read and type as hex than as long binary strings, while the mapping to bits stays obvious.

Does this converter handle big numbers?

Yes. It uses arbitrary-precision integers, so values beyond 64 bits (for example 256-bit hashes written as decimal) are converted exactly, with no rounding.

Is my input sent to a server?

No. The conversion runs in your browser. The site has no backend that receives your numbers.