Free browser converter
Binary to Hex Converter
Convert binary bits to hexadecimal digits in your browser with explicit ASCII, Unicode code point, and UTF-8 byte handling.
Interactive tool
Convert binary bits to hexadecimal digits
Ready
Choose the exact representation you need; the tool does not guess an encoding.
Detailed conversion guide
How to Convert Binary to Hex
Starting at the right, split the binary value into four-bit groups. Each group maps to one hexadecimal digit: 0010 is 2, 1111 is F, and 1010 is A.
If the first group is short, the converter pads it on the left. It maps nibbles directly, so values longer than JavaScript's safe integer range stay exact.
| Input | Output | Meaning |
|---|---|---|
0000 | 0 | one nibble |
1010 | A | one nibble |
1111 | F | one nibble |
0010 1111 | 2F | two nibbles |
Binary to Hex in JavaScript and Python
Validate every bit before conversion. Grouping into nibbles preserves display width; BigInt is suitable when you need the numeric value instead.
// validate first, then convert
const value = Number.parseInt(token, radix);
if (!Number.isInteger(value)) throw new Error("Invalid input");Leading Zeros, Prefixes, and Invalid Binary
Leading zeros can be meaningful in registers and protocol fields. This tool pads to a complete nibble and keeps the resulting hex width.
Only digits 0 and 1 are accepted. A 0b prefix and common separators are syntax; signs, decimal points, and other digits are rejected.
Related converters
Continue converting ASCII and Unicode
Choose the converter for the direction and representation you need.