The Numeric Systems: Conversion from Decimal to Hexadecimal

 

Converting a Byte From Decimal to Hexadecimal

To convert a decimal value of a byte to its hexadecimal equivalent, again keep in mind that the maximum number you are dealing with is 255 (this is because the operation will be a little different later on). Find the remainder of the decimal number by 16. This remainder will constitute the low group of four bits. The result will constitute the high group of four bits. Therefore, use the table of numeric conversions to find the equivalent hexadecimal number for each group.

Let's convert decimal 225 to hexadecimal. The remainder of 225 by 16 is 1 and the natural result is 14. Using the table of numeric conversions, decimal 14 = hexadecimal E. Decimal 1 = hexadecimal 1. Therefore, the decimal number 225 has a hexadecimal value of 0XE1.

As another example, Let's convert the decimal 203 to the hexadecimal system. The remainder of 203 divided by 16 is 11 and the natural result is 12. Using the table of numeric conversions, decimal 12 = hexadecimal C; decimal 11 = hexadecimal B. Therefore, decimal 203 = hexadecimal 0XCB

 

Practical Learning Practical Learning: Converting a Byte From Decimal to Hexadecimal

  1. On the Calculator, click the Dec radio button
  2. Using the buttons on the window, enter 225
  3. Click the Hex radio button to see the result
  4. Click the Dec radio button
  5. Press the numeric keys on the keyboard to display 203
  6. Click the Hex radio button to see the result

Converting any Number From Decimal to Hexadecimal

To convert any number from decimal to hexadecimal, find the remainder of the number by 16. This remainder would be the LO group of four bits. Use the quotient to find the remainder by 16; this remainder would be the second group of four bits. Continue until the decimal is less than 16.

Consider a decimal number such as 1325 to convert to hexadecimal:

  • The remainder of 1325 by 16 is. The remainder of 1325 divided by 16 is 13 and the quotient is 82. Therefore the left number will be 13.
  • The remainder of 82 divided by 16 is 2 and the quotient is 5. Therefore, the second number from left is 2; this would produce 2 and 13.

Since the quotient, 5, is less that 16, it will be put to the left of the existing numbers. We get 5 | 2 | 13. According to the table of numeric conversions, decimal 13 = hexadecimal D. Therefore, decimal 1325 = hexadecimal 0x52D

Let’s convert decimal 462834 to hexadecimal:

Number Divided By Remainder Quotient
462834 16 2 28927
28927 16 15 1807
1807 16 15 112
112  16 0 7

The different combination of 4 bits of this number are 7 | 0 | 15 | 15 | 2. According to the table of numeric conversions, decimal 15 = hexadecimal F. The number is 7 | 0 | F | F | 2. Therefore, the hexadecimal equivalent of the decimal number 462834 is 0x70FF2

Practical Learning Practical Learning: Converting a Number From Decimal to Hexadecimal

  1. Click the Dec radio button and click the buttons to display 1325
  2. Click the Hex radio button to see the result
  3. Click the Dec radio button
  4. Press the numeric keys on the keyboard to display 462834
     
  5. Click the Hex radio button to see the result
     
 
 

Previous Copyright © 2003-2009, FunctionX Next