Random Color Generator
Generate a grid of random colors in HEX, RGB or HSL — pick how many, copy any value with one click, and regenerate instantly for design inspiration.
How to use
- Set how many colors you want and choose a format (HEX, RGB or HSL).
- Click Generate for a new set — or change the count to reshuffle automatically.
- Copy any color with the button on its swatch.
About this tool
ShowHide
Generate 1 to 48 random colours and read each one as HEX, rgb() or hsl(). Every swatch is three bytes straight from crypto.getRandomValues, so the draw is uniform over all 16,777,216 sRGB triples and unpredictable rather than merely shuffled.
Uniform over RGB is not uniform to the eye, and the gap is bigger than it sounds. Sampling all 16.7 million triples equally gives a mean HSL saturation of about 67, because a colour needs all three channels to land close together to look muted and that is rare: only 1.2% of the space has its channels within 16 of each other, and just 0.99% has all three above 200. So pastels and near-greys essentially never come up, while vivid mid-tones come up constantly. Sorted by OKLab lightness the same set lands 0.3% in the darkest fifth and 40% in the fourth — perceptually dark colours are almost absent, because sRGB's gamma encoding spends most of its code values on the bright end.
The three formats are not interchangeable labels for the same thing. HEX and rgb() are exact — the same three bytes written two ways — but hsl() is rounded to whole degrees and whole percents, and that rounding does not survive a round trip. Feed every one of the 16,777,216 colours through the conversion and back and only 1,775,056 of them — 10.6% — return the byte you started with; the rest drift by up to 5 per channel. Copy the HEX when the value has to be exact, and treat the HSL as a readable description of the swatch rather than a second copy of it.
Frequently asked questions
Can I switch between HEX, RGB and HSL?
Yes. Changing the format re-displays the same colors in the new notation, so you can grab whichever your project needs without regenerating.
Are the colors truly random?
They come from the browser's cryptographically secure random generator (crypto.getRandomValues), spread evenly across all RGB values — not weighted toward any hue.
How do I get a whole new set?
Click Generate, or change the count. The current set is kept until you do, so you won't lose a color you liked by accident.
Do you store or upload the colors?
No. Generation happens entirely in your browser; nothing is sent anywhere. Your last set is saved only in your own browser for convenience.
Why do the colors all look mid-toned rather than pastel or near-black?
Because a uniform draw over the RGB cube is not uniform over lightness. Sampling the whole cube puts about 73% of results at an HSL lightness between 33% and 67%, and only about 2% each above 85% or below 15%. If you need pastels or deep shades, generate a batch and filter, or fix the lightness yourself in HSL.
Does the HSL string convert back to the same color?
Usually not exactly. HSL here is rounded to whole degrees and whole percent, which loses information: about 87% of RGB triples do not survive the round trip, though the error is small — at worst 3 out of 255 on a channel. #EF19FD becomes hsl(296, 98%, 55%), which converts back to #EE1CFD. Copy the HEX or RGB form when the exact value matters.
Related tools
HSL Color Picker
Drag hue, saturation, lightness, and alpha sliders to dial in a color — copy HEX, RGB, HSL, or a Tailwind arbitrary value.
Color & CSS
Wavelength to Color Converter (nm → sRGB)
Convert a light wavelength in nanometres (380–780 nm) to an approximate sRGB color, with a clickable rainbow bar and Fraunhofer reference lines.
Color & CSS
Color Format Converter
Convert any color between HEX, RGB, HSL, HSV, OKLCH, and a CSS custom property.
Color & CSS
CMYK ↔ RGB Color Converter (Print Color Space)
Convert between RGB / hex screen colors and CMYK percentages for print — simple, GCR and UCR black generation, plus a total ink coverage readout.
Color & CSS
CSS Named Colors
All 147 CSS / X11 named colors with HEX, RGB, and a live swatch — searchable and grouped by hue.
Color & CSS
Tailwind Color Palette
The full Tailwind CSS v4 default palette — 22 hues × 11 shades, 50 through 950 — with click-to-copy as Tailwind class, HEX, or rgb().
Color & CSS