Topics / Number Systems / Uses of Hexadecimal

Uses of Hexadecimal

What are hexadecimals used for?

There are several uses of hexadecimals in computing, as outlined below:


HTML / CSS Colour Codes

Hexadecimal numbers are often used to represent colours within HTML or CSS.

The 6 digit hex colour code should be considered in three parts.

  • First two digits represents the amount of red in the colour (max FF, or 255)
  • The next two digits represent the amount of green in the colour (max FF, or 255)
  • The final two digits represent the amount of blue in the colour (max FF, or 255)

By changing the intensities of red, green and blue, we can create almost any colour.

E.g. orange can be represented as #FFA500, which is (255 red, 165 green, 0 blue).

Visit hexinvaders.com to see this in action.


MAC Addresses

A Media Access Control (MAC) address is a number which uniquely identifies a device on the internet.

The MAC address relates to the network interface card (NIC) inside of the device.

e.g. D5-BE-E9-8D-44-9C

Expressing MAC addresses in hexadecimal format makes them easier to read and work with.


Assembly Code and Memory Dumps

Hexadecimals are beneficial (over binary) because:

  • They are easier and faster to work with, taking up less screen space
  • Mistakes are less likely and easier to trace / debug

Finally

  • Remember, a big benefit of hexadecimals is that they are easy to convert to binary, if needed.
  • In the examples above, all values are still physically stored as binary, so no storage space is saved by using hex.
Topics / Number Systems / Uses of Hexadecimal

Popular Downloads