Binary to Hexadecimal

Convert binary to hexadecimal:

Binary is base 2 and hexadecimal is base 16. Each group of 4 binary digits (a nibble) converts to exactly 1 hexadecimal digit.

Example conversion

Convert the binary number 10100011 to hexadecimal:


          Split into nibbles: 1010 | 0011
          1010 = A (in hex)
          0011 = 3 (in hex)
          
          10100011₂ = A3₁₆
        

Simply convert each 4-bit group to its hexadecimal equivalent and concatenate them.

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

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

Method

To convert a binary number to hexadecimal:

  1. Group the binary digits into sets of 4, starting from the right
  2. Convert each 4-bit group to its hexadecimal equivalent
  3. Concatenate (join) all the hexadecimal digits together
  4. Add leading zeros to the leftmost group if needed to make it 4 bits

Each 4-bit binary group (nibble) corresponds to exactly one hexadecimal digit:

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

Convert 11010110 to hexadecimal:

  • Group into nibbles: 1101 | 0110
  • 1101 in binary = D in hexadecimal
  • 0110 in binary = 6 in hexadecimal
  • Concatenate: D + 6 = D6
  • Therefore 110101102 = D616

References: