How the conversion works
Repeatedly divide the decimal number by 16 and record the remainder at each step. Remainders from 10 to 15 are written as A through F. Read the remainders from bottom to top to form the hex result.
For example, decimal 255 divided by 16 gives quotient 15 remainder 15, then quotient 0 remainder 15, producing hex FF.