Sometimes you just need a color, fast — a placeholder, a fresh idea, or random test data. This generator produces a uniformly random hex code on every click and shows it full size so you can judge it immediately.
How it works
A hex color packs three 8-bit channels into one 24-bit value. The generator picks a single random integer in the range 0 to 16,777,215 and formats it as a six-digit hexadecimal string with a leading hash:
value = floor(random() * 16777216)
hex = "#" + value.toString(16).padStart(6, "0")
Because the integer is uniform across the entire range, every possible color is
equally likely. The tool then splits the hex back into red, green, and blue
bytes to show the matching rgb() value.
Notes and tips
To keep the displayed code legible on any background, the tool measures the
color’s relative luminance using the standard 0.2126R + 0.7152G + 0.0722B
weighting (after linearizing each channel) and flips the label between black and
white. Random colors are great for breaking creative blocks: generate a few,
keep the ones that surprise you, and feed them into the Monochromatic Palette
Generator to build a full scale around your favorite.