Skip to main content
Home / Code Snippets / JavaScript / Random Hex Color

Random Hex Color

var randomColor = Math.floor(Math.random()*16777215).toString(16);

View Demo

There is also a PHP version.