Hex Binary

Live, bidirectional conversion. Everything runs locally — nothing is sent anywhere.

    Batch conversion

    Paste one value per line, or comma-separated. Free and unlimited — export straight to CSV.

    InputOutput

    Results will appear here.

    Same value, other bases

    Computed automatically from the value above — no need to retype it on another page.

    Binary as the base computers actually use

    Binary is base 2: every digit is either 0 or 1, and each position represents a power of 2 instead of a power of 10 or 16. It's the number system computers use natively because a transistor, at the level of a logic gate, is most reliably built as a two-state switch — on or off, high voltage or low voltage — rather than a device that reliably distinguishes ten or sixteen different levels. Every other base discussed on this site, hex included, is really just a more compact human-readable notation for the same underlying binary state.

    That's also exactly why hex exists as a notation. A single bit carries very little information and a raw binary string is hard to read at a glance — 11010110 takes a moment to parse, while its hex equivalent, D6, is two characters. The relationship isn't approximate: because 16 is 2 raised to the 4th power, each hex digit corresponds to exactly four binary digits, with no rounding or remainder. That clean 4-to-1 grouping is unique to hex among the common non-binary bases; octal's 3-to-1 grouping (2³ = 8) works too, but doesn't align with the 8-, 16-, 32-, and 64-bit widths modern hardware actually uses.

    Converting between hex and binary by hand

    Because of that exact 4-bit correspondence, converting hex to binary doesn't require any arithmetic at all — it's a lookup. Take each hex digit independently and write out its 4-bit binary equivalent: 0 is0000, 7 is 0111, A is 1010, F is 1111. Concatenate the groups in order and the result is the full binary value. For 0x2F: 2 becomes0010, F becomes 1111, giving 00101111. Going the other direction, split the binary string into groups of 4 starting from the right (padding the leftmost group with leading zeros if needed), then convert each group back to its hex digit.

    This is different from converting hex to decimal, which does require positional weighted-sum arithmetic because decimal's base doesn't share a clean power-of-two relationship with 16. The binary conversion is simpler precisely because both bases are powers of 2.

    Where raw binary representations matter

    Most developers read and write hex rather than binary day to day, but a handful of situations call for seeing the actual bit pattern. Bitmask and flag fields — where individual bits represent independent boolean options packed into one integer — are far easier to reason about in binary than in hex, since hex hides exactly which bits are set within each nibble. Debugging a bitwise AND, OR, or XOR operation often means writing both operands out in binary to see which bits actually changed. CPU instruction encodings, register flags (like the x86 FLAGS register), and network protocol headers with sub-byte fields are typically documented bit by bit, requiring a binary view to line values up correctly. Binary literals are also directly supported in several programming languages — Python, Java, C++14 and later, and Rust all accept a 0b prefix — as an alternative to hex for exactly these cases.

    Why binary won over other physical encodings

    Early computing machines experimented with more than two states — some 1940s designs considered decimal circuits that tried to represent all ten digits directly in hardware. Binary won out for a practical reason: distinguishing two voltage levels reliably is far easier than distinguishing ten, especially as components degrade or signals pick up noise. A binary circuit only has to answer one question (above or below a threshold), which makes it cheaper to build, faster to switch, and much less sensitive to small variations in voltage. The mathematical groundwork for treating true/false logic as arithmetic — Boolean algebra, developed by George Boole a century before electronic computers existed — turned out to map onto two-state circuits almost exactly, which is part of why binary hardware and logical operations (AND, OR, NOT) are so tightly connected in how CPUs are actually built.

    A multi-byte worked example

    For a value spanning more than one byte, the same digit-by-digit lookup still applies — it just produces a longer string. Take 0x1A2B, a 16-bit value. Split it into its four hex digits and convert each independently: 1 → 0001, A → 1010, 2 → 0010, B →1011. Concatenated in order, that's 0001101000101011, a 16-bit binary string. Grouped into bytes for readability, it reads 00011010 00101011. Notice that the leading zero on the first nibble is preserved — hex digit 1 is 0001, not just 1 — because each hex digit always expands to exactly four binary digits regardless of its value.

    Reading binary at a glance

    Binary strings get hard to parse past 8 or so digits, which is why they're conventionally grouped — either in nibbles of 4 to match hex digits, or in bytes of 8. A 32-bit value is far more legible written as 1010 1100 0011 0000 than as one unbroken string of 32 characters, and most disassemblers, debuggers, and hardware datasheets follow that convention. When comparing two binary values to find which bits differ — a common debugging task — grouping them identically and reading column by column is more reliable than scanning a single long string for mismatches.

    FAQ

    What is 0xFF in binary?
    0xFF equals 11111111 in binary. Each hex digit maps directly to exactly 4 bits, so two hex digits give 8 bits.
    Does this handle very large numbers?
    Yes — conversions use arbitrary-precision arithmetic, so hex values of any length convert correctly, not just 32- or 64-bit integers.
    Can I convert a list of values at once?
    Yes — use the batch converter below. Paste one value per line or comma-separated, and export the results as a CSV file.
    g then:h homeb basee encodingc colorp programming