Hexadecimal to Binary

Convert hexadecimal to binary:

Hexadecimal is base 16, this means there are 16 digits: 0-9 and A-F. Each hexadecimal digit converts to exactly 4 binary digits (a nibble).

Example conversion

Convert the hexadecimal number A3 to binary:


          A = 1010 (in binary)
          3 = 0011 (in binary)
          
          A3 = 10100011
        

Simply convert each hex digit to its 4-bit binary equivalent and concatenate them.

          Hex    Bin
          0      0000
          1      0001
          2      0010
          3      0011
          4      0100
          5      0101
          6      0110
          7      0111
          8      1000
          9      1001
          A      1010
          B      1011
          C      1100
          D      1101
          E      1110
          F      1111

Converting from hexadecimal to binary is straightforward because each hexadecimal digit represents exactly 4 binary digits (bits).

Method

To convert a hexadecimal number to binary:

  1. Convert each hexadecimal digit to its 4-bit binary equivalent
  2. Concatenate (join) all the binary groups together
  3. Remove any leading zeros if not required as a full byte

Each hexadecimal digit corresponds to exactly one nibble (4 bits) in binary:

      Hex    Bin
      0      0000
      1      0001
      2      0010
      3      0011
      4      0100
      5      0101
      6      0110
      7      0111
      8      1000
      9      1001
      A      1010
      B      1011
      C      1100
      D      1101
      E      1110
      F      1111
Example

Convert 2F to binary:

  • 2 in hexadecimal = 0010 in binary
  • F in hexadecimal = 1111 in binary
  • Concatenate: 0010 + 1111 = 00101111
  • Therefore 2F16 = 001011112

References: