Random Color Generator

Generate random colors instantly. Press Space for a new color. Filter by mood: pastel, dark, warm, cool.

#7C3AED
HEX #7C3AED
RGB rgb(124, 58, 237)
HSL hsl(262, 83%, 58%)
or press Space
Random Palette (5 Colors)
Who this tool is for:

Best for: Breaking a blank-page block by generating an unexpected starting colour, and producing random hex values to test how a component renders

Limitations: Generates colours without checking contrast, so anything used for text still needs an accessibility check afterwards

Best suited for: Designers stuck at the start of a palette who need a prompt rather than a decision

How the Random Color Generator Works

Press Generate Random Color or Space, then copy the HEX, RGB or HSL value. New Palette draws five colors with the current filter, each on its own. Every value comes from the browser's Math.random, without a seed, so a sequence cannot be replayed; the code does not use the cryptographic crypto.getRandomValues.

The Any filter computes Math.floor(Math.random() * 16777216), an integer from 0 to 16,777,215, so every hex from #000000 to #FFFFFF is equally likely. The other filters pick whole-number HSL values with rand(min, max), both ends included. Hue 360 is the same colour as hue 0, so the full-circle filters draw hues 0 to 359, which gives each of the 360 hues the same chance:

FilterHueSat. %Light. %On whiteOn black4.5:1 on white4.5:1 on black
Anyany hex, #000000 to #FFFFFF1.01 to 20.821.01 to 20.7136.6%65.3%
Light0 to 35930 to 7070 to 901.09 to 3.486.03 to 19.210%100%
Dark0 to 35930 to 7010 to 304.14 to 19.451.08 to 5.08about 99.9%0.1%
Saturated0 to 35970 to 10040 to 601.07 to 11.531.82 to 19.630.3%71.8%
Pastel0 to 35920 to 4078 to 901.16 to 2.0810.1 to 18.160%100%
Warm0 to 6060 to 10040 to 651.07 to 7.232.91 to 19.6611.8%90.1%
Cool180 to 26040 to 8040 to 651.42 to 11.521.82 to 14.8148.8%53.8%

The contrast columns come from 100,000 draws per filter, computed with this tool's own code (method). Math.random differs between runs, so a rerun gives slightly different shares.

What the Filters Suit

Light and Pastel never reached 4.5:1 on white in those draws but always reached it on black, so they suit backgrounds and test fills under dark text. Dark is the reverse, for white text, but not guaranteed: its lowest draw was 4.14:1 on white. Any, Saturated, Warm and Cool land on both sides of 4.5:1, which makes them useful test data for a component that must choose its own text color, and unsafe for text you place by hand.

Frequently Asked Questions

The code uses Math.random with no seed, so a sequence cannot be repeated, and it does not use the browser's cryptographic generator, crypto.getRandomValues. Each color, including each of the five palette swatches, is drawn independently.
The Any filter runs '#' + Math.floor(Math.random() * 16777216).toString(16).padStart(6, '0'). 16777216 is 256 x 256 x 256, the number of hex colors, so every color from #000000 to pure white #FFFFFF is equally likely.
Use the Pastel filter. It picks any whole-number hue from 0 to 359, each equally likely, saturation 20 to 40% and lightness 78 to 90%. In 100,000 computed draws pastel colors reached only 1.16:1 to 2.08:1 on white and at least 10.1:1 on black, so put dark text on them.
It depends on the filter. In 100,000 computed draws per filter, 36.6% of Any colors reached 4.5:1 on white and 65.3% on black. Light and Pastel never reached it on white, and Dark reached it on white in about 99.9% of draws. Check text pairs in the Contrast Checker.
Not by design. Each swatch is drawn independently with the current filter, so the filter range is all they share. For colors built from one base hue, use the Palette Generator's complementary, analogous, triadic or monochromatic types.
Related Tools

Get fresh reads straight to your inbox

Get notified when we publish new articles. Unsubscribe anytime.