Binary to Hexadecimal Converter — Compact Bits into Hex
Last updated:
Compress long binary strings into compact hexadecimal. Because one hex digit equals four binary bits, the conversion is a straight lookup — no base-10 detour, no floating-point drift. Useful for hex dumps, color codes, and reading raw byte values.
Binary ⇄ Hex Converter
How binary to hex works
Group the bits into 4-bit nibbles starting from the right. Each nibble maps to one hex digit: 0000=0, 1010=A, 1111=F. If the bit-count is not a multiple of 4, the tool left-pads with zeros so nothing gets mis-aligned.
Quick examples
| Binary | Hex |
|---|---|
1010 | A |
11111111 | FF |
0001 0010 | 12 |
1010 1011 1100 1101 | ABCD |
11110000 10101010 | F0AA |
How to use
- Paste your binary into Input. Spaces between bits or nibbles are stripped before grouping.
- Hex appears in Output, upper-case, no
0xprefix. Add the prefix yourself if you need it. - To go the other way, hit Hex → Binary at the top, or press Swap.
- Tap Copy to grab the hex string. All conversion happens client-side.
Real-world use cases
- Memory dumps and debugger output. An 8-, 16-, or 32-bit register collapses from a wall of
0s and1s into 2, 4, or 8 hex characters, which fits one screen line and stays readable when you scan a backtrace. - Hash and cryptographic inspection. SHA-256, MD5, and HMAC outputs are almost always presented as hex. Flipping a hex digest back to binary via hex to binary lets you compare bit patterns when verifying a one-bit change or studying the avalanche effect.
- CSS and design tokens. A color like
#FF00FFsplits into three byte-aligned channels; sliding each channel back to binary shows exactly which bits drive red, green, and blue, which is handy when explaining color depth or alpha blending. - Byte-boundary recognition. Because 8 bits land neatly on 2 hex digits, hex makes it obvious where one byte ends and the next begins — something that's almost impossible to eyeball in a long binary string without counting.
- Teaching base systems. Hex is the cleanest bridge between base-2 and the higher-radix worlds students see in decimal work; the rule "4 bits = 1 hex digit" is the first piece of bit-twiddling intuition that actually sticks.
- Packet and protocol analysis. Wireshark, tcpdump, and most protocol decoders print byte streams in hex by default. Converting a suspicious field back to binary is often how you spot a misaligned flag bit or an off-by-one length header.
Why hex is binary's natural shorthand
Hexadecimal won out as binary's everyday shorthand for one reason: 16 is a power of two. Because 2⁴ = 16, every group of 4 bits maps to exactly one hex digit with no leftover and no arithmetic — a property no other common base shares. Base-10, the system humans actually count in, can't do this: a decimal digit covers the range 0-9, which doesn't align with any whole number of bits, so binary-to-decimal conversion always involves division and remainders.
Early machines didn't all settle on hex straight away. Word-oriented systems from the late 1950s and early 1960s, such as the 36-bit IBM 7090 and the later PDP-series minicomputers, often displayed memory in octal (base-8), since 3 bits per octal digit fit a 36-bit word evenly. Hex pulled ahead once the 8-bit byte became the universal unit — a shift driven largely by IBM's System/360 in the mid-1960s, which standardised the 8-bit byte across an entire product line. After that, "1 byte = 2 hex digits" was simply too convenient to ignore.
The choice of A-F for the values 10-15 is also an IBM legacy. Earlier experimental systems had tried other glyphs (some used U-Z, others picked Greek letters), but IBM's documentation for the System/360 era settled on 0-9 followed by A-F, and that convention was later locked in by ANSI and IETF standards. This converter follows it: digits are upper-case by default, odd-length inputs are left-padded with zeros to the next multiple of 4, and any whitespace between groups is silently ignored before conversion.
Worked examples
A few inputs done by hand show the 4-bit grouping rule in action:
00001010 → 0A (one byte)
Split into nibbles from the right: 0000 and 1010. The first nibble is 0, the second is A (= 10). Joined left-to-right, the byte is 0A. Note that the leading zero is preserved — dropping it would change "one byte" into "half a byte" and break alignment with the next byte in a stream.
11111111 → FF (all bits set)
Both nibbles are 1111 = F, so the result is FF. This is the largest value a single unsigned byte can hold (255 in decimal). You'll see FF constantly in color codes (pure red, green, or blue channel), permission masks, and "uninitialised memory" sentinel values.
1111000010101010 → F0AA (two bytes)
Sixteen bits split into four nibbles: 1111 0000 1010 1010 → F, 0, A, A → F0AA. This is exactly two bytes, so it could equally well be written F0 AA with a space between bytes — most hex viewers do that for readability.
Odd-length input: 101 → 5
Only 3 bits, which isn't a multiple of 4. The tool pads the left side with one zero to get 0101, which is 5. This is the same behaviour you'd get from a calculator that treats short inputs as positive integers — it never pads on the right, because that would multiply the value by 2.
Common pitfalls
- Case mixing. The output is upper-case
A-F, but the reverse direction (hex to binary) accepts either case. Don't waste time normalising case before pasting — the parser handles it. - Reading hex as decimal.
10in hex is16in decimal, not ten. If a register dump showsFFand you mentally read it as "ninety-nine", every downstream calculation will be off. When in doubt, route the value through a known-good binary translator to cross-check. - Losing byte boundaries.
F0AAlooks like four hex characters but is actually two bytes (F0 and AA). When copying into a protocol field that expects a byte count, divide the hex length by 2, not by 4. - Confusing this output with IPv6. IPv6 addresses also use hex, but they're written in colon-separated groups of four hex characters (
fe80::1), with lower-case letters and a special::shorthand for runs of zeros. This converter produces plain, unseparated upper-case hex — paste it into an IPv6 context and the format won't match. - Separators in the input. Any whitespace inside the binary input is stripped before grouping, so
1111 0000and11110000produce the same result. Non-binary characters (anything other than0,1, or whitespace) are flagged rather than silently dropped.
Frequently asked questions
Why does every hex digit cover exactly 4 binary bits?
Because hexadecimal is base-16 and 16 = 2⁴. Four binary bits can express 0–15, which matches one hex digit (0–F). That mapping is direct, no arithmetic needed.
What happens if my binary length is not a multiple of 4?
The tool pads the left side with zeros so the bits group cleanly. So 101 → 0101 → "5", not "11" or an error.
Is the hex output upper-case or lower-case?
Upper-case (0-9, A-F). Most engineering tooling — assembly listings, hex dumps, MAC addresses — uses upper-case, so that's the default here.
Should I add a 0x prefix to the result?
The tool outputs the bare hex digits with no prefix. Add 0x yourself if you're pasting into C/Python source; leave it off for documents or hash strings.
How is this faster than converting through decimal?
Going binary → decimal → hex needs full base conversion. Binary → hex is just slicing the bit-string into 4-bit chunks and looking each up — O(n) with no arithmetic. The page uses that direct path.
Why is the hex output upper-case rather than lower-case?
Upper-case is the long-standing convention in assembly listings, hex dumps, MAC addresses, and most debugger output, mainly because 0-9 and A-F are visually distinct at a glance — lower-case "b" and "d" can blur with "6" and "0" in cramped fonts. The tool follows that convention by default.
What if my binary length is not a multiple of 4 bits?
The converter pads the left side with zeros until the bit-count is a multiple of 4, then groups from the right. So 101 becomes 0101 → "5", and 1 11111111 becomes 0001 11111111 → "1FF". This matches how every standard hex viewer handles short inputs.
Can I get lower-case hex output?
Not directly from this tool yet — the result is always upper-case A-F. If you need lower-case (some style guides for CSS colors or JSON Web Tokens require it), copy the output and run a single toLowerCase() in your editor, or paste into a shell pipe like `pbpaste | tr "A-F" "a-f"`. The hex digits themselves are identical, only the letter case changes.