Random Color Generator
Generate random colours in HEX, RGB or HSL, lock the ones you like, and check text contrast against WCAG thresholds.
Selections are generated locally in your browser using the Web Crypto API when available. The result is chosen before the animation starts, so how the animation looks can never change what is picked.
Loading the random color generator…
What is the Random Color Generator?
A palette generator with an accessibility check built in. Every swatch shows its HEX and RGB values, whether black or white text reads better on it, the exact contrast ratio, and whether that ratio passes WCAG AA or AAA.
Lock the swatches you want to keep and regenerate the rest — the usual way palettes actually get built, one lucky colour at a time.
How to use it
- Choose how many colours you want and the display format.
- Press “Generate palette”.
- Lock any colour you want to keep.
- Regenerate to replace only the unlocked swatches.
- Copy an individual value, or download the whole palette as CSV.
How the random selection works
Each colour is three independent draws — red, green and blue — each a rejection-sampled integer from 0 to 255. That gives a uniform draw over the full 16.7 million sRGB colours. HSL values are converted from the RGB triple rather than generated separately, so the displayed formats always describe the same colour.
The full algorithm — including the rejection-sampling step and the wheel stop-angle calculation — is written out on the methodology page.
Practical examples
- Building a starting palette for a chart or a dashboard.
- Finding a random accent colour that still passes contrast with white text.
- Generating distinct colours for categories in a diagram.
- Teaching colour models by comparing HEX, RGB and HSL for the same swatch.
Available options
- HEX, RGB and HSL output.
- One to 24 colours per palette.
- Lock and regenerate individual swatches.
- Contrast ratio against black and white, with AA/AAA rating.
- Copy per swatch, or CSV export of the whole palette.
Privacy
Colour generation involves no personal data. Everything you type stays in this browser tab. There is no account, no upload step and no server-side copy of your list: the draw runs in JavaScript on your own device. Nothing is written to browser storage unless you explicitly save a list or tick the option to keep your draw history, and both can be cleared at any time from the privacy page.
Full details are in the privacy policy, which also has a button that deletes everything this site has stored in your browser.
Fairness and limitations
The draw is uniform across the RGB cube, which is not the same as uniform across colours as people perceive them — sRGB devotes more of its space to some hues than others, so a truly random palette will often feel unbalanced. That is a property of the colour space, not a bug. Use the lock button and a few regenerations to shape it.
Frequently asked questions
What does the contrast rating mean?
It is the WCAG 2.1 contrast ratio between the swatch and the better of black or white text. 4.5:1 passes AA for normal text, 3:1 passes AA for large text, and 7:1 passes AAA.
Why do random palettes often look wrong?
Because a uniform draw from RGB does not respect how we perceive colour harmony. Lock the colours that work and regenerate the rest.
Can I export to my design tool?
Download the CSV — it contains HEX, RGB, HSL and both contrast ratios, which imports cleanly into most tools.