Binary to Hex Converter
Convert binary (base 2) numbers to hexadecimal (base 16).
Hexadecimal
Binary to hexadecimal, explained
Hexadecimal is a compact way to write binary: every four bits (a nibble) map to exactly one hex digit. To convert, group the bits into fours from the right and translate each group — so 11111111 (two nibbles of 1111) becomes ff. This tool handles arbitrarily long bit strings, entirely in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Compressing a long bit pattern into hex for documentation or a log line.
- Converting a computed bit pattern into the hex a debugger or a config expects.
- Checking that a mask you built in binary reads correctly in hex.
- Producing a hex constant from a bitwise expression's result.
- Making a 32-bit value readable at a glance.
Frequently Asked Questions
- Why is this conversion trivial?
- Because 16 is 2^4, so each group of four bits maps to exactly one hex digit with no arithmetic or carrying. 11111111 splits into 1111 1111 = FF. Grouping is the entire operation.
- Which end do I group from?
- The RIGHT, always. Grouping from the left mis-aligns everything when the bit count is not a multiple of four: 111011 is 11 1011 = 3B, not 1110 11. Pad with leading zeros to make the alignment explicit.
- Why not just use binary?
- Length. A 32-bit value is 32 binary characters and only 8 hex ones, and humans reliably miscount long runs of identical bits. Hex is a notation for binary, not a different representation of the value.
- How does this relate to bitmasks?
- Directly — 0xF0 is 11110000, so it selects the high nibble, and 0x0F the low. Flag constants are usually designed so that their hex form makes the bit pattern obvious to anyone who groups by four.
- What is a nibble?
- Four bits, exactly one hex digit and half a byte. The term is a deliberate pun on byte and appears in specifications describing packed BCD and protocol headers where two fields share one byte.
- How does this apply to reading a hex dump?
- Each hex pair is one byte, so a dump's columns map directly to memory offsets. Converting a suspicious pair to binary is how you check an individual flag bit without reasoning about the whole value.
- Why are the digits grouped in fours?
- Because four bits is exactly one hex digit, so the boundary never splits a digit. Grouping in threes would suit octal instead — the grouping follows the target base, not the source.
- What happens to a bit count that is not a multiple of four?
- It is padded on the LEFT with zeros, since padding on the right would multiply the value. That is why `101` becomes `0101` and reads as 5, not as 10.
Common errors and gotchas
- Grouping from the wrong end. Hex digits map to four bits from the least significant, so padding goes at the front.
- Failing to pad to a multiple of four bits, which shifts every digit.
- Losing the width when leading zeros are dropped, so a 32-bit mask looks like a 20-bit one.
- Assuming byte order is implied. The hex shows the value, not how it sits in memory.
- Mixing case inconsistently in a format that specifies one or the other.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.