How to convert decimal to hexadecimal in JavaScript Convert a number to a hexadecimal string with: And reverse the process with: