If the equations are not displayed correctly, please use the desktop view
Binary and hexadecimal numbers are often used in Electrical Engineering, especially when we are dealing with digital programming and computer science. Along with these two, we also know the ten numbering system consists of ten single-digit numbers (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
Binary number is used to represent the logic gates (0 and 1) while the hexadecimal number uses 0-9 followed by A-F.
Binary number is indicated by “b” or “2” at the end of the number (0110b or 01102).
Decimal number is indicated by nothing or “10” at the end of the number (27 or 2710).
Hexadecimal number is indicated by “h” or “16” at the end of the number or 0x at the front (5Fh or 5F16 or 0x5F).
Decimal Numbers System (Base 10)
Decimal number system is the numbering system we use the most. It consists of ten numbers (0 – 9) and it is the same number of our fingers. In order to fully understand how we convert between binary, decimal, and hexadecimal numbers, we need to understand the most familiar first, the decimal number.
The decimal number consists of ten numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. And each digit has the power of 10. The total value of a decimal number is the sum of each digit with the ascending power of ten from right to left.
For easier explanation, observe the table below. Assume we have a number of 3216:
The total value is
And both are equal.
Binary Numbers System (Base 2)
Binary is the number system we use in logic gates to represent true (1) and false (0). It is mostly used for computing calculation and machine programming.
The binary number system is the base 2 and each digit has the power of 2 starting from the power of 0 and increases from the right to left. Binary number value is determined by the binary number (0 and 1) and the power of 2.
In order to indicate a binary number we put a lower case “b” at the end of the number. For example, 1011b.
Binary and Decimal Numbers
For easier understanding, let’s say we have the binary number 1011b. Our objective is to convert this binary number into a decimal number. We put the binary number and the base 2 in a single table.
Its decimal number is:
Thus, 1011b is equal to 11 in decimal.
Hexadecimal Numbers System (Base 16)
Hex numbers are the shorthand for base 2.
Hexadecimal numbers have the power of 16, or we can call it base 16 numbers. Each digit has the power of 16. Hexadecimal has sixteen (16) numbers: (0-9) followed by (A-F). Hex numbers or base 16 numbers have the most possible numeric number thanks to the alphabetical A-F representing the value of 10-15.
Hexadecimal and Decimal Numbers
Next to fully understand the hexadecimal number (base 16), we will try to convert a hexadecimal number to the decimal number. Assume that we have A21E. Now let us do the mathematical conversion below.
Remember that A represents 10 and E represents 14. Thus,
Hence, the hex number A21E is equal to 41502 in decimal number. Just like we use lower case “b” at the end of binary number, we use lower case “h” at the end of hexadecimal number or using 0x at the front.
So, for the hexadecimal number, we write A21Eh or 0xA21E.
Binary – Decimal – Hexadecimal Conversion Table
Observe and use the table below when converting between binary, decimal, and hexadecimal numbers. For some conversion, we need to use the table especially when converting from the higher value number to lower value number.
Binary to Decimal Number
Just as explained above,
The n-digit binary number:
And the equivalent decimal number is
Assume that we have a binary number 1010b, thus
Binary to Hexadecimal Number
Binary to hexadecimal number conversion will not involve calculation like what we did with binary to decimal. Rather than that, we need to use a binary to hexadecimal conversion table as seen above.
Next we will divide every 4 digits of the binary number and convert it in accordance with the table.
For example, we have the binary number 1010011b to hex number:
First we divide it by 4 digits starts from the back
101 0011
We convert the 101 in binary into 5 in the hex. The 101b is equal to 0101b and from the table is equal to 5 in the hex.
We convert the 0011 in binary into 3 in the hex.
Thus the equal hexadecimal number is
1010011b = 53h
Decimal to Binary Number
In order to convert decimal to binary number, we need to follow these steps properly. Assume that we have a decimal number, 15.
First, we divide the number by 2 but we need the integer value and its remainder.
We divide 15 by 2 and we get integer 7 and remainder 1.
Second, we save the remainder value into our bit. The first remainder we get will be put at d0 or the most right or the most back. Thus we have the binary xxx1b. We need to find the remaining three.
Third, we repeat these two steps until the remainder is zero.
For example, our decimal number 15:
Thus 15 is equal to 1111b as listed in the table above.
Decimal to Hexadecimal Number
The conversion from decimal to hexadecimal is similar to the decimal to binary number conversion. The only difference is we replace the division of 2 with the division of 16. Assume we have the decimal number 6927.
Thus, the conversion sequence is
Thus 6927 is equal to 1B0Fh.
Hexadecimal to Binary Number
This one is pretty straightforward. Assume that we have a hexadecimal number 2Ah.
First, we divide every digit of the hex number
2A = 2 A
and convert each of them according to the table.
2 = 10
A = 1010
Thus 2Ah is equal to 101010b
Hexadecimal to Decimal Number
A Hexadecimal number is a number that each digit has the power of 16. The power value starts at 0 and increases from the right to left.
The hex number with n digits:
The total decimal value of a hex number is
For example, we have a hex number 2Ah, then the decimal number is
Thus, the hex number 2Ah is equal to 42 in decimal.