Divide your number by 16^0 (1). If the result is > 16 then divide your decimal number by 16^1 (16). If the result > 16 then divide your decimal number by 16^2 (256). If then result is > 16 then divide your decimal number by 16^3 (4096). If the result is > 16 divide your decimal number by 16^4 and so on until the result is < 16.
For example for 2000, you can divide it by 16^2 (256). 2000/256 = 7,8125.
Now you must take the entire part of 7,8125 (7) and multiply it by 16^2 (256) : the result is 7*256 = 1792.
Substract this result from 2000 : 2000 - 1792 = 208.
Then divide 208 by 16^1 (16) : 208/16 = 13 (0xD hex).
Substract 13*16 from 208 : 208 - 208 = 0
Divide 0 by 16^0 : 0/1 = 0
The final result in hex is : 7D0 ((7*16^2) + (13*16^1) +(0*16^0))
Try another example with 10001 decimal
10001/16^3 = 2,44.... (Entire value is 2)
2*16^3 = 8192
10001 - 8192 = 1809
1809/16^2 = 7,06... (Entire value is 7)
7*256 = 1792
1809-1792 = 17
17/16^1 = 1,06... (Entire value is 1)
1*16^1 = 16
17-16 = 1
1/16^0 = 1 (Entire value is 1)
The final result is 0x2711 (hex value).
Not very complicated...