Representing Hexadecimal Numbers

What is hexadecimal?

  • Hexadecimal serves as a more human-friendly representation of binary-coded values

  • Hexadecimal is a base-16 number system that consists of:

    • 10 numbers (0-9)

    • 6 letters (A-F)

Why use hexadecimal instead of binary?

  • It is more concise as four binary bits (e.g. 1010) can be represented with one hexadecimal character (e.g. A)

  • It is easier for humans to read and write

  • It is less prone to error as it is more likely to be communicated correctly

Potential uses of hexadecimal

  • It is commonly used for debugging, configuring hardware devices, and in cryptographic algorithms

  • It is also commonly used to define colours. As there are millions of colours in the visual spectrum that require very large binary numbers to represent them, they can be replaced with shorter hexadecimal values

hexcolours Sample hexcolours

Hexadecimal Lookup Table

  • The hexadecimal lookup table serves as a quick reference for converting numbers between denary, binary and hexadecimal values

  • The hexadecimal scale is identical to the denary scale until the tens column is introduced

  • When the denary scale reaches 10, this is when the hexadecimal scale switches to letters, starting with A

DenaryBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

Using subscript in number representation

  • The subscript in number representation denotes the base of a number

  • It helps in differentiating between number systems

  • Common uses:

    • indicates the number is in binary (base 2), and its value is ‘10’ in binary

    • indicates the number is in denary (base 10), and its value is ‘10’ in denary

    • indicates the number is in hexadecimal (base 16), and its value is ‘10’ in hex, equivalent to ‘16’ in denary

  • It provides clarity, especially in contexts where multiple numbering systems are discussed

Denary to Hexadecimal

Convert the denary number 241 to hexadecimal.

Step 1: Convert the number to binary

number to binary

Step 2: Split the binary number into nibbles

binary number to nibbles

Step 3: Convert each nibble into its hexadecimal value

nibbles to hexadecimal values

Step 4: Final result

The denary number 241 is F1 in hexadecimal.

Hexadecimal to Denary

Convert the hexadecimal value 1A to denary.

Step 1: Convert each hexadecimal character into binary

hexadecimal character to binary

Step 2: Join the binary values

binary values

Step 3: Final result

16 + 8 + 2 = 26

The hexadecimal value 1A is 26 in denary.

Binary to Hexadecimal

Convert 1101 0101 to hexadecimal.

Step 1: Take the binary values

Binary values

Step 2: Convert each nibble into its hexadecimal value

nibble to hexadecimal

Step 3: Final result

The binary number 11010101 is D5 in hexadecimal.

Hexadecimal to Binary

Convert B2 from Hexadecimal to Binary.

Step 1: Split the Hexadecimal into two separate digits and convert each to a nibble

hexadecimal to nibble

Step 2: Join the two nibbles to make a byte (8 bits)

nibbles

Step 3: Final result

The hexadecimal number B2 in Binary is 10110010