Uses of hexadecimal
There are several uses for hexadecimals in computing:
HTML / CSS Colour Codes
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.
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.
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
- 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.