DevKits

Binary to Hex Converter — Base-2 to Hexadecimal Online

Convert a binary (base-2) string to hexadecimal. Every 8 bits become 1 hex byte; input is separator-tolerant (space, comma, hyphen, or continuous bits). Optional '0x' prefix and uppercase output. 100% local.

Last updated:

35 chars · 1 lines

Need to go the other way? Hex to Binary →

Convert a binary (base-2) string to hexadecimal. Every 8 bits become 1 hex byte. Input is separator-tolerant — space, comma, hyphen, or continuous bits all work. Optional '0x' prefix and uppercase output.

What is Binary to Hex?

Binary-to-hex is the compact-serialization inverse of hex-to-binary: 8 bits collapse to 2 hex characters. Nothing depends on text encoding — the transformation is exact. The tool strips all non-0/1 characters before parsing, so multi-line inputs, comma-separated bit groups, and continuous bit streams all decode identically. For inputs whose length isn't a multiple of 8, the tool left-pads with zeros; this matches the way you'd think about 'a number' being a multi-bit value, and is what programmers actually want 99% of the time. If strict validation matters for your use case, verify the length before pasting.

How to convert binary to hex online

  1. 1Paste binary — any format with 0s and 1s. Separators are ignored.
  2. 2The tool left-pads to a multiple of 8 bits and groups them into bytes.
  3. 3Pick uppercase / lowercase and optional '0x' prefix.
  4. 4Copy the resulting hex.

Use Cases

Summarize a long bit stream

128 bits are hard to eyeball, but 32 hex chars are easy. Convert to hex before pasting into a bug ticket or diff.

Compare with an expected hash

When a debugger dumps a bit stream and you want to check it against a SHA-256 hex — convert to hex first, then compare.

Format machine output for a report

Raw binary printed by embedded devices is tedious. Hex halves the length and adds structure.

Tips & Best Practices

  • Both this tool and Hex to Binary are byte-level, not integer-level. For integer number-base conversion, use the Number Base Converter.
  • The '0x' prefix option produces valid C / Python / Rust literals — convenient for pasting straight into code.
  • Lowercase hex is the modern convention (matches Python .hex() and Node buffer.toString('hex')); uppercase is common in older tooling and some crypto specs (X.509).

Frequently Asked Questions

How does the conversion work?

The tool strips everything except 0s and 1s, left-pads to a multiple of 8 bits, then converts each 8-bit group to a 2-digit hex byte. So '01001010' becomes '4a', and '010010100100 1011' (spaces ignored) becomes '4a4b'.

What if my binary string is not a multiple of 8?

The tool left-pads the input with zeros to the nearest multiple of 8. If you want stricter behavior, verify the input length first.

Can I get uppercase hex output?

Yes — flip the 'Uppercase' toggle to output 4A instead of 4a. You can also add '0x' prefixes per byte.

Is this the same as decimal-to-hex?

No — this tool treats the input as a byte stream and outputs each byte as 2 hex chars. Decimal-to-hex interprets the input as a single integer. For that use the Number Base Converter.

Related Tools