Decimal to Hex Conversion Using by Indirect Method
As mentioned above this method converts the decimal number into a binary number or octal first and then converts the binary or octal number to a hexadecimal number.
Decimal to Binary to Hexadecimal
By repeatedly dividing a number by two and recording the result, decimal values can be transformed into binary.
Conversion of Integral Decimal Numbers
Step 1: Divide the number by 2.
Step 2: Get the integer quotient for the next iteration.
Step 3: Get the remainder for the binary digit.
Step 4: Repeat the above steps until the quotient is equal to 0.
Take a look at an example to see how this works.
The remainders are to be read from bottom to top to obtain the binary equivalent.
\(43_{10} = 101011_{2}\)
A binary number can be converted to a hexadecimal number in a variety of ways.
The processes to convert a binary number to a hexadecimal number are as follows.
Step 1: Consider the binary number.
Step 2: For the integer component, divide the binary digits into four groups (beginning from the right), and for the fraction part, start from the left. Each set of four binary digits should be converted to one hexadecimal digit.
This is a basic algorithm in which you combine binary numbers and substitute their hexadecimal equivalents.
Also go through this article on Sets once you have read this article.
Because the hexadecimal number system has only 16 digits (from 0 to 7 and A to F), we may express each hexadecimal digit using only four bits, as seen below:
Hexa | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
Hexa | 8 | 9 | A | B | C | D | E | F |
Binary | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Learn about Binary to Octal here.
Solved Example
Convert binary number 1010101101001 into a hexadecimal number.
Therefore, Binary to hexadecimal is,
\(= (1010101101001)_2\)
\(= (1 0101 0110 1001)_2\)
\(= (0001 0101 0110 1001)_2\)
\(= (1 5 6 9)_{16}\)
\(= (1569)_{16}\)
Know more about Sequences and Series here.
Decimal to Octal to Hexadecimal
Converting with Remainders and Converting with Division are two ways for converting a decimal number to an octal number. These are explained in the next paragraphs.
Converting with Remainders (For the integer part)
This is a straightforward method that involves dividing the number to be converted. If the decimal number is N, divide it by 8 because the octal number system’s base is 8. Note the value of the residual, which will be one of the following: 0, 1, 2, 3, 4, 5, 6, or 7. Divide the remaining decimal number until it equals 0 and record the remainders of each step. Then, from bottom to top (or in reverse order), write the remainders, which will be the equivalent octal number of the provided decimal number.
Solved Example
Note: The dividend (here given decimal number) is the number to be divided, the divisor (here base of octal, i.e., 8) is the number to be divided by, and the quotient (remaining divided decimal number) is the outcome of the division.
Converting with Division
This approach works by guessing the decimal number’s octal number. You’ll need to make an 8-power table. The algorithm for the integer component is described as follows.
Step 1: Any decimal number can be used as a starting point.
Step 2: Make a list of the powers of eight.
Step 3: The decimal number should be multiplied by the highest power of eight.
Step 4: Find the rest of the numbers.
Step 5: Multiply the residual by the eighth power.
Step 7: Repeat until you’ve figured out the whole solution.
Solved Example
Octal to Hexadecimal
When converting from octal to hexadecimal or Hexadecimal to Octal Conversion, it’s common to convert from octal to hexadecimal by first translating the octal integer to a binary digit, and then from binary to hexadecimal. To convert the number 536 from octal to hexadecimal, for example.
Solved Example
Converting 536 from octal to hexadecimal is an example.
When we convert 536(octal) to binary, we get (536)8 = (101) (011) (110) = (101011110)
To obtain its hexadecimal equivalent, build a group of four binary bits (101011110) = (0001) (0101) (1110) = (0001) (0101) (1110) = (0001) (0101) (1110) (15E)
As a result, the hexadecimal value of 536 is 15E.
Here’s how to convert from Hexadecimal to Octal using steps!