ADC home pageIntroductionGoalsWhy digitize?Number RepresentationDigital to AnalogAnalog to DigitalApplicationsLiterature Citations

Hexadecimal

Choose Subtopic

Decimal to Hex Conversion

Step 1: find the highest power of 16 that is LESS than the number being converted. Call this power M so we have a symbol for the power.

Step 2: divide the number by the 16M. The integer part of the quotient will be between 1 and 15. Record this number (in Hex form from the table at near the top of this web page) as the lead symbol. The remainder is the additional part of the number that still must be converted.

Step 3: If the remainder is bigger than 16M-1, go back to Step 2 (using 16M-1 instead of
16M) to find the next symbol, which will go one space to the right of the first symbol. If the remainder is smaller than 16M-1, put a 0 in the place to the right of the lead symbol, and check if the remainder is bigger than 16M-2. If it is, go to step 2, using 16M-2 instead of 16M, otherwise recording a 0, looking at 16M-3, and so on until digits have been accounted for i.e. a symbol has been placed in the 160 place.

Example: convert 12345678. This number is between 165 and 166, so there will be 6 Hex symbols. 12345678/165 = 12345678/1048576 = 11.77... on a calculator, so the symbol here is the Hex representation of 11 = B.

12345678 - B*1048576 = 12345678 - 11*1048576 = 12345678 - 11534336 = 811342.

The next smaller power of 16, 164 = 65536. This is smaller than 811342, so the symbol in the 164 place is >0. 811342/65536 = 12.38..., the symbol for 12 is C, and the remainder in this position is

811342 - C*65536 = 811342 - 12*65536 = 24910. At this point, the conversion result is BCxxxx.

Next, 163 = 4096, 24910/4096 = 6.08, symbol is 6, and that's the same Hex or decimal. BC6xxx, and the remainder is 24910-6*4096 = 334. 162 = 256, 334/256 = 1, remainder 334-256 = 78. BC61xx. 78/161 = 4, remainder 78-64 = 14, whose symbol is E, and the final conversion is BC614E.

Exercise: convert 87654321 to Hex.

   
 

 

University of Illinois Homepage The Camille & Henry Dreyfus Foundation Homepage Home Scheeline Group Home Page Univ. of Illinois at Urbana-Champaign Home Page Department of Chemistry Home Page Creative Commons License System Homepage