How to use the random color generator
- Pick how many colors you want, from 1 to 8.
- Choose a style: Any color, Pastel, Vivid, Dark or Grayscale.
- Press New colors or the space bar. Every color that is not locked changes.
- Click the lock on a color you like. It stays put while the others keep changing, so you can build a palette one color at a time.
- Click the HEX, RGB or HSL code to copy it. A short message under the colors confirms the copy.
Every color you generate goes into Recent colors, so a good one is never lost when you press the space bar once too often. Click a small square there to copy its HEX code. When you have a set you like, press Save palette. Saved palettes stay in this browser, and Use brings one back with all its colors locked.
HEX, RGB and HSL explained
All three codes describe the same color in different ways, and you can paste any of them into CSS, design apps or most paint programs.
- HEX, like
#3A7BD5, writes the red, green and blue amounts as three pairs of hexadecimal digits. Each pair runs from 00 to FF, which is 0 to 255. - RGB, like
rgb(58, 123, 213), gives the same three amounts as plain numbers. With 256 levels per channel there are 16,777,216 possible colors. - HSL, like
hsl(215, 65%, 53%), is easier for people to adjust. Hue is the position on the color wheel in degrees (0 is red, 120 is green, 240 is blue), saturation is how strong the color is, and lightness runs from black at 0% to white at 100%.
HSL is handy for making variations. Keep the hue and change the lightness, and you get lighter and darker shades of the same color for hover states, borders and backgrounds.
What the color modes do
Any color is fully random. Expect plenty of muddy browns and grayish greens, because a large part of the RGB space is made of them. Pastel keeps lightness high and saturation moderate, which suits baby announcements, soft backgrounds and spring themes. Vivid pushes saturation close to the maximum at medium lightness, good for buttons, game graphics and sports colors. Dark gives deep shades for dark themes and text. Grayscale picks a single value for red, green and blue, so you get neutral grays from black to white.
Contrast and readable text
Each color shows its contrast ratio against white and against black, calculated with the formula from the Web Content Accessibility Guidelines (WCAG 2). The ratio goes from 1:1 (no difference) to 21:1 (black on white). The rules most designers follow are:
| Ratio | Result | Good for |
|---|---|---|
| 7:1 or more | AAA | Body text at any size |
| 4.5:1 or more | AA | Normal text, the usual minimum |
| 3:1 or more | AA Large | Large text (about 24px, or 19px bold) and icons |
| Under 3:1 | Fail | Decoration only, not for text |
The codes on each swatch are drawn in white or black, whichever has more contrast with that color. If neither passes AA, the color works better as a background accent than behind long text. Keep in mind that contrast is only part of the story: about 1 in 12 men has some form of color vision deficiency, so do not rely on hue alone to carry meaning. You can check your own eyes with the color blind test.
Ideas for using random colors
- Break a creative block. Lock one color you must use, such as a brand color, and generate the rest until something clicks.
- Art challenges. Generate three colors and paint or draw something using only those. It works well for pixel art; try it in the pixel art maker.
- Games and classrooms. Show one color and ask players to name it, guess its HEX code or find an object of the same color in the room.
- Placeholder colors. Developers can grab quick colors for charts, avatars and test data.
Need random numbers instead, for example to pick RGB values by hand or draw raffle tickets? The random number generator covers any range you like.
Questions
How random are the colors?
In Any color mode, the red, green and blue values are each picked from 0 to 255 with your browser’s cryptographic random number generator, so all 16,777,216 colors have the same chance. The other modes first pick a random hue, then keep saturation and lightness inside a range that gives the chosen style.
What does the contrast ratio on each color mean?
It compares the color with white text and with black text using the WCAG 2 formula. A ratio of 4.5:1 or more passes level AA for normal text, 3:1 is enough only for large text, and 7:1 or more passes level AAA. The small “Aa” samples show how each option really looks.
Where are my saved palettes stored?
In your browser’s local storage on this device. Nothing is sent to a server, so saved palettes do not follow you to another browser or phone, and clearing your site data removes them. Use Copy to keep a palette somewhere safe.
Why does the color name say “Near”?
Only 140 or so colors have a CSS name, out of more than 16 million. The generator finds the named color that looks closest, measured in the CIELAB color space, which follows human vision better than plain RGB distance. If the code matches a named color exactly, “Near” is left out.
Can I use these colors in my own projects?
Yes. Colors and color codes are not owned by anyone, so you can use any color you generate in websites, art, logos or school work without asking.