Q&A for How to Convert from Decimal to Hexadecimal

Return to Full Article

Search
Add New Question
  • Question
    How do I convert 1111001 to a hexadecimal?
    Community Answer
    Since every 4 bits in a binary code is 1 hex number, the best thing to do is convert each 4 bits into a decimal number then into a hex number. 1001₂ would be 8 plus 1 which is equal to 9. 0111₂ would be 4 plus 2 plus 1 which would then be 7. The answer is 79₁₆.
  • Question
    Can I convert decimals to hexadecimals?
    Community Answer
    Start with number n, for the sake of having an example, let's say 86. Take the number and divide by 16 -> 5R6. If the result of your initial division (not the remainder) is greater than 16, then you must divide that number by 16. In this case, 86dec is equal to 56hex.
  • Question
    I am struggling with the Fast Remainder method. I don't understand why it works. Why - the remainders can contribute to a correct answer for the whole? Yet, it seems to be very popular, so I am trying
    Community Answer
    This is going to sound stupid, but it might help explain why the algorithm is "obviously" correct: Try using it to convert base 10 to base 10. Pick any number in base 10, say 15069. Divide it by 10. 1506, remainder 9. Divide 1506 by 10. 150, remainder 6. Divide 150 by 10. 15, remainder 0. Divide 15 by 10. 1, remainder 5. Divide 1 by 10. 0 remainder 1. See? It really is obvious. Each time, you're just picking off the least significant digit in whatever base you divide by.
  • Question
    How do I convert 145.02 base 8 to hexadecimal?
    Community Answer
    Method 1: Convert to decimal first. 145(octal) = 1x8² + 4x8¹ + 5x8⁰ = 64 + 32 + 5 = 101(dec). Divide 101 by 16 to get 6 + remainder 5, therefore 142(octal) = 65(hex). For the fractional part, 0.02(octal) = 0x(1/8¹) + 2x(1/8²) = 2/64 = 1/32 = 0.03125(dec). Multiply 0.03125 by 16 to get 0.5, which has a whole number part of 0. Multiply 0.5 by 16 to get 8. Put the 0 and the 8 after the (hexa)decimal point to get 0.08(hex). Result = 65.08(hex). Method 2: Convert to binary first. 145.02(octal) = 001 100 101.000 010. Then group into 4-bit nibbles to get 0110 0101.0000 1000. Convert each nibble into hex (see How to Convert Binary to Hexadecimal ) to get 65.08(hex).
  • Question
    How do I convert 98735 base 2 to hexadecimal?
    Community Answer
    98735 is not in base 2. Each digit cannot be larger than the base - 1, so for base 2, the digits cannot be larger than 1. 98735 to binary (base 2) is 11000000110101111. To convert binary to hexadecimal, take each group of 4 bits and convert each to hexadecimal. 0001 1000 0001 1010 1111₂ = 181AF₁₆
  • Question
    Find the solutions in hexadecimal of: 4E + 6B?
    Community Answer
    4E is 78 in decimal (base 10). 6B is 107₁₀. 78₁₀ + 107₁₀ = 185₁₀. Which is B9 in hexadecimal. You can also do it in hexadecimal: E+B = 14₁₀ + 11₁₀ = 16₁₀ + 9₁₀ = 19(hex). In other words, it is 9(hex) plus a carry of 1. Now add 4 + 7 = 11₁₀ = A, add the carry to give B. The answer is B9.
  • Question
    How do you convert a negative decimal to hex, using the first method? Example -495 according to the programmer calculator is FFFF FFFF FFFF FE11‬. How do you get that the longhand way?
    Dylbill
    Community Answer
    You first figure out the hex of the positive value, which is 1ef, then for each digit do (15 - digit) so 1ef becomes e10, then add 1 to that hex, e10 becomes e11, then add an f to the beginning. e11 becomes fe11.
  • Question
    I have another question. Using the first method dec 1079160 returns 17778, while the actual hex answer, according to a programmer calculator is 107778. Is there a way to correct this?
    Dylbill
    Community Answer
    In the first step, if the decimal remainder is less than 0.0625 you add at least one 0 to the digit. If there are more than 1 zeros to the right of the period, you count the zeros and subtract 1 and add that many zeros to your digit. Examples: 1,078,160 / 1,048,576 = 1.029. So the first digit is 10. In the next step you still do 1 x 1,048,576, not 10 x 1048576. Another example: 4097 to hex. 4097 / 4096 = 1.000244. There are 3 zeros to the right of the period, so your first digit is 100. 4096 X 1 = 4096. 4097 - 4096 = 1. hex answer = 1001.
  • Question
    How do I convert 10001101010001101111 to hexadecimal?
    Community Answer
    Assuming this is binary (if this is decimal, convert it to binary). Split the binary into 4 bit chunks (nibbles): 1000 1101 0100 0110 1111. Convert the nibbles into the hexadecimal: 8D46F.
  • Question
    How to convert decimal number 1011 to hexdecimal?
    Community Answer
    Start by converting the decimal 1011 to binary: 1111110011. Now break the binary number into nibbles (4 bits/binary digits): 0011 1111 0011. Now convert the nibbles into their respective hexadecimal: 3F3.
  • Question
    How do I convert a base decimal in to a hexadecimal?
    Community Answer
    Convert it to binary, break it down into 4 bit chunks (nibbles), convert the nibbles into the respective hexadecimal.
Ask a Question

      Return to Full Article