Binary and hexadecimal conversions
Computers work on the principle of number manipulation. Inside the computer, the numbers are represented in bits and bytes. For example, the number three is represented by a byte with bits 0 and 1 set to "00000011" which is a numbering system using base 2. People commonly use a decimal or Base 10 numbering system.
What this means is that, in Base 10, you count from 0 to 9 before adding another digit. For example, the number 22 in Base 10 means we have two sets of 10's and two sets of 1's.
Base 2 is also known as binary since there can only be two values for a specific digit; either a 0 = OFF or a 1 = ON. You cannot have a number represented as 22 in binary notation. The decimal number 22 is represented in binary as 00010110. By following the below chart, that breaks down to:
22 or 00010110:
All numbers representing 0 are not counted, 128, 64, 32, 8, 1 because 0 represents OFF.
However, numbers representing 1 are counted, 16 + 4 + 2 = 22 because 1 represents ON.
Decimal values and binary equivalents chart
Another numbering system used by computers is hexadecimal, or Base 16. In this system, the numbers are counted from 0 to 9, then letters A to F, before adding another digit. The letters A through F represent decimal numbers 10 through 15, respectively. The below chart indicates the values of the hexadecimal position compared to 16 raised to a power and decimal values. It is much easier to work with large numbers using hexadecimal values than decimal.
To convert a value from hexadecimal to binary, you merely translate each hexadecimal digit into its 4-bit binary equivalent. Hexadecimal numbers have either a 0x prefix or an h suffix.
For example, consider the hexadecimal number:
Using the Binary chart and the Hex chart below, this translates into the binary value:
0011 1111 0111 1010