Binary to Hex Converter — Instant Base-2 to Hexadecimal
Convert binary numbers to hexadecimal instantly. Every 4 bits become one hex digit. Free, runs in your browser, arbitrary precision.
Supports arbitrary-precision integers via BigInt — no 2⁵³ overflow. Handles negative numbers and the standard 0b/0o/0x prefixes. All conversion happens in your browser.
Converting binary to hex, explained
Binary (base 2) and hexadecimal (base 16) are tightly related: every group of 4 bits maps to exactly one hex digit. That makes binary-to-hex conversion the fastest of all base conversions — no arithmetic, just group the bits into nibbles from the right and replace each nibble with its hex equivalent. This binary to hex converter does the grouping and lookup instantly in your browser, so converting a 64-bit register dump to its 16-character hex form is just as cheap as converting a single nibble.
The nibble grouping trick
To convert a binary number to hex by hand:
- Pad the left side with zeros so the total length is a multiple of 4.
- Split the bit string into groups of 4 from the right.
- Replace each 4-bit group with its hex digit using the nibble table.
For example, converting 101111001010:
1011 1100 1010 ← 3 nibbles B C A Result: BCA
The nibble table is the same 16-entry lookup used for hex-to-binary in the reverse direction: 0000=0, 0001=1, ..., 1001=9, 1010=A, ..., 1111=F. Once memorized, binary-to-hex is pure visual pattern matching.
How to use this binary to hex converter
- Type or paste a binary number (zeros and ones only) into the binary field.
- The hex field updates live with the base-16 equivalent. Decimal and octal also appear for reference.
- Spaces between nibbles are tolerated —
1010 0110works the same as10100110. - Hex output is lowercase without a
0xprefix.
Examples
Binary Hex 0 0 1 1 1010 a 1111 f 10000 10 11111111 ff # one byte 10000000 80 1111111111111111 ffff # uint16 max 100000000000000000000000 800000
When you actually need binary to hex
- Compacting a register dump. You have a 32-bit binary value and want to write it in a bug report — 8 hex characters is far more readable than 32 bit characters.
- Formatting a bit pattern for display. Hardware docs often show bit fields in binary; when you need to write the value in code or a config file, hex is the compact form.
- Encoding for transmission. Log formats and wire protocols use hex rather than binary because it is 4× shorter.
- Working with MAC addresses and IDs. Some datasheets describe the underlying bit layout; you transcribe it to hex to match the product label.
- Teaching bit manipulation. Students compute expressions in binary for clarity; hex is the form they write in real code.
Why base 16 is the natural companion to base 2
16 is 2 raised to the 4th power. Because of that, any base conversion between base 2 and base 16 is pure digit substitution — no arithmetic required. The same property holds for octal (base 8 = 2^3), which was popular in the 1960s and 70s when word sizes were 12, 18, or 36 bits. Modern 8-bit-byte hardware makes hex more natural: a byte is 8 bits, which is 2 hex digits, which is 2 octal digits plus a leftover bit that makes groups awkward. Hex won because it aligns with the byte.
Privacy
This binary to hex converter runs entirely in your browser. Conversion happens locally with JavaScript BigInt — no server, no network request, no logging. Safe for any bit string you are debugging.
Frequently asked questions
Does the tool accept spaces in binary input?
Yes. Spaces between nibbles are stripped automatically, so 1100 1010 and 11001010 both convert to ca.
Is there a maximum bit length?
No practical limit. BigInt supports arbitrary-precision integers, so 256-bit or 1024-bit binary values convert correctly.
Why is my binary input truncated?
Leading zeros are dropped on display — the tool treats the input as a number, not a bit string. If you need zero-padded output, start from a longer binary value or pad the hex output yourself to the desired width (4 bits per hex digit).
How do I convert binary to hex in code?
JavaScript: parseInt(bits, 2).toString(16) or BigInt('0b' + bits).toString(16) for large values. Python: hex(int(bits, 2)). C: useprintf("%x", ...) after parsing with strtol base 2.
Can hex represent all binary values?
Yes. Every binary integer has a unique hex representation (pad to a multiple of 4 bits first). The only caveat is that fractional binary values (bits after a binary point) do not map cleanly to short hex unless the fraction happens to have a power-of-2 denominator.
Related tools
- Number BaseConvert numbers between binary, octal, decimal, and hexadecimal instantly. Live bidirectional conversion with explanations — free, runs in your browser.
- Hex to BinaryConvert hexadecimal numbers to binary instantly. Each hex digit maps to 4 bits. Free, runs entirely in your browser, zero dependencies.
- Binary to DecimalConvert binary numbers to decimal instantly. Arbitrary precision, handles any bit-width. Free, runs in your browser — no ads, no signup.