Hexadecimal numbers are a compact way of representing large numbers. They are useful in computer programming because computers use bytes as their main unit of information. A byte can represent an alphanumeric character or one of 256 decimal numbers. It normally requires 8 binary digits to represent a byte but in hexadecimal only two are required.
In the
RGB Color System used in computers there are 256 possible levels of brightness for each component in an RGB (Red, Green, Blue) color. So the red component, blue component and the green component can each be represented by a byte, or two hexadecimal digits. An entire RGB color can therefore be represented by six hexadecimal digits.
To avoid confusing hexadecimals with other numbers, they are prefixed with either 0x or $ to indicate that they are hexadecimal.
This guide explains how hexadecimal numbers are derived and used.
Navigation:
Part 1:
Hexadecimal vs Decimal
Understanding hexadecimal numbers: A comparison with normal decimal numbers.
Part 2:
Converting Hexadecimal Numbers to Decimal Numbers
If expressions like 0xFE2 or $6E mean nothing to you, this section will explain what to do with them.
Part 3:
Converting Decimal Numbers to Hexadecimal Numbers
This section demonstrates how to calculate the hexadecimal equivalent of a decimal number.
Part 4:
Hexadecimal Arithmetic
Hexadecimals are numbers too! This section contains some simple examples of arithmetic operations in hexadecimal.