Math.floor(Math.random() * 0xffffff).toString(16); // or... `#${Math.floor(Math.random() * 0xffffff).toString(16)}`; Last Updated:January 1, 2023