Format Code Now
/
Web & markupRandom Color Generator Next: JavaScript Formatter ›

Random Color Generator

WM-15

Press Generate for random colors as hex codes, or switch the format to RGB, HSL, HSV or CMYK. Pick 1, 5, 10 or 25 at a time.

Runs in your browser. Nothing is uploaded.

Not used (press Generate)

Random colors

How to use it

  1. Choose how many colors, 1, 5, 10 or 25, and the format.
  2. Click Generate. Click again for a fresh set.
  3. Copy the list or download it as a text file.

How the colors are picked

Each color uses three random bytes from your browser's crypto.getRandomValues, one each for red, green and blue. That means all 16,777,216 RGB colors are equally likely. Other formats are converted from that color and rounded to whole numbers. The page does not use Math.random, and nothing is stored or sent anywhere. The input box is not used.

What random means here

Picking each channel evenly gives many mid-range, muted colors, because most RGB colors are not fully saturated. The page does not avoid duplicates, keep colors apart or check that two colors are readable together. If you need readable pairs, run the pair through the contrast checker.

Using the output

Hex output works in CSS, design tools and most code. Tick uppercase if your style guide wants it. For HSL, HSV or CMYK, the values are rounded, so converting them back may differ by a step from the original random color.

Questions people ask

How do I get a random hex color?

Press Generate with the Hex format. Each result is a six-digit code such as #4a9f2c made from three random bytes. Pick up to 25 at once, then copy the ones you like.

Is the color really random?

It comes from crypto.getRandomValues, the browser's secure random source, rather than Math.random, and every RGB color is equally likely. It is random, not designed, so many of the results will not look good together.

How do I generate a random color palette?

Generate 5 or 10 colors and keep the ones that work together. The page does not harmonize them, so expect to pick and tweak. Use the tint and shade generator to build variations of a color you like.

Can I get random colors as RGB or HSL?

Yes. Change the Format menu to RGB, HSL, HSV or CMYK and press Generate again. The colors are made as RGB first and then converted, with whole-number rounding for the other formats.

Why do I get so many dull colors?

Picking each channel evenly makes mid-range values common, which gives muted colors. Bright, saturated colors are a smaller share of all RGB colors. For vivid results, pick an HSL hue and fix saturation yourself.

About this tool

Each color is built from three random bytes (red, green, blue) from the browser crypto.getRandomValues, generated locally, so every one of the 16,777,216 RGB colors is equally likely. The other formats are converted from that color and rounded to whole numbers. The colors are not checked against each other, so you can get near-duplicates, and not for contrast, so a random pair may be unreadable together. The input box is ignored. Nothing is stored or sent anywhere.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.