Hex to Binary Converter

Type a base-16 number and get its binary form, one 4-bit group per hex digit.

    Going the other way? Use the binary to hex converter.

    To convert hex to binary, replace each hex digit with its 4-bit binary group and keep the order. For 2F, the 2 expands to 0010 and the F to 1111. Joined together that is 00101111, or 101111 once the leading zeros drop off.

    How it works

    Every hex digit stands for exactly four binary digits, because base 16 is base 2 raised to the fourth power. Conversion is therefore pure substitution: look up each hex digit in the table, write down its 4-bit group, and move to the next digit. No division, no place-value sums, no carrying.

    Worked example with 2F. The digit 2 is worth 2, which is 0010 as a nibble. The digit F is worth 15, the largest single hex digit, which is 1111. Concatenate in order: 00101111. As a plain number the front zeros carry no value, so the converter reports 101111, and both spellings equal 47 in decimal.

    The order of groups never changes and groups never overlap, which makes this direction even easier than binary to hex: there is no decision about where to split, since every hex digit is its own tidy package of four bits.

    Where you will use this: reading flag values in code, unpacking color channels from a hex color, checking which bits are set in a hardware register, or verifying by eye that two byte sequences differ in a single bit. Programmers store values as hex precisely because this expansion is instant. Memorize a few anchor rows, F is all ones, 8 is one followed by zeros, 0 is all zeros, and you can sight-read most values without the table.

    The digit table: all 16 expansions

    HexBinaryDecimal
    000000
    100011
    200102
    300113
    401004
    501015
    601106
    701117
    810008
    910019
    A101010
    B101111
    C110012
    D110113
    E111014
    F111115

    FAQ

    How do I convert hex to binary?

    Replace each hex digit with its 4-bit binary group from the table, keeping the digits in order. For 2F, the digit 2 expands to 0010 and F expands to 1111, giving 00101111. Written as a plain number that is 101111, since leading zeros drop off.

    Does letter case or a 0x prefix matter?

    No. Hex digits A through F mean the same thing in either case, so 2f and 2F are identical. The converter also accepts a 0x prefix, the standard marker programmers put in front of hex values, along with spaces or underscores used as separators inside long numbers.

    Why is my binary result shorter than four bits per digit?

    Leading zeros vanish when you write a value as a plain number. Expanding 2F digit by digit gives 00101111, and dropping the front zeros leaves 101111. Both spellings are worth 47. Pad back to a multiple of four or eight when the bit layout matters.