Saved

Press the star next to a tool's name to save it.

All my tools

Random Color Generator

This random color generator makes random colors as swatches with HEX, RGB and HSL codes, in styles like pastel, vivid or dark, and copies them in a click.

Click any swatch to copy its HEX code. Press Generate again for a new set.

Colors are made in your browser. Nothing is uploaded.

Your random colors

A random color generator picks colors at random so you can find fresh ideas for a design, a game, a classroom activity or a decision you can't make. Choose how many colors you want and a style, such as pastel, vivid or dark, press Generate, and this random color generator shows each color as a swatch with its HEX, RGB and HSL codes. Click a swatch to copy its HEX code, or copy the whole set as CSS variables.

How to use the random color generator

  1. Choose how many colors: 1, 3, 6, 12 or 24.
  2. Choose a style: any color, pastel, vivid, dark, muted or grays.
  3. Press Generate. A new set appears every time.
  4. Click a swatch to copy its HEX code, or copy all the codes at once.
  5. Copy the CSS variables to paste the set straight into a stylesheet.

How colors are written

Web colors are written in the 24-bit RGB color scheme. A hex triplet, such as #3A86FF, is a six-digit hexadecimal number made of three bytes, for red, green and blue. Each byte runs from 00 to FF in hexadecimal, which is 0 to 255 in decimal, from the lowest to the highest intensity of that color. That gives 256 × 256 × 256, or 16,777,216, possible colors. The same color can be written as rgb(58, 134, 255), and in HSL as hue, saturation and lightness, which is easier to reason about when you want a lighter or duller version of a color.

The styles

StyleHow it's pickedGood for
Any colorRed, green and blue each picked at random from 0 to 255Surprises and true randomness
PastelAny hue, medium saturation, high lightnessSoft backgrounds, baby and spring themes
VividAny hue, high saturation, middle lightnessButtons, highlights, logos
DarkAny hue, low lightnessDark themes and text
MutedLow saturationCalm, earthy palettes
GraysNo saturationNeutral shades

Readable labels on every swatch

Each swatch shows its codes in black or white, whichever has more contrast with that color, worked out from the color's brightness. That keeps the codes easy to read on very pale and very dark colors alike. When you use a random color for text or buttons, check its contrast against the background with the color contrast checker, so everyone can read it.

Ideas for using random colors

  • Design inspiration: generate pastel or muted sets until a combination clicks, then refine it.
  • Placeholders: give each card, chart series or avatar its own color while you build a layout.
  • Games and classrooms: pick a color for a team, a drawing prompt or a guessing game.
  • Generative art: start a piece from a random palette.
  • Decisions: can't choose a paint or theme color? Let chance shortlist a few.

Using a color you like

Copy its HEX code into your design tool, or paste the CSS variables into your stylesheet and use them with var(--color-1). To see more details about a color, such as its CMYK values, its nearest named color or matching shades, open it in the color picker.

Truly random?

The colors are drawn using your browser's cryptographic random number generator where it's available, so every value is equally likely and the results are unpredictable. Each press of Generate is independent of the last.

Building a palette from random colors

Random colors are a starting point, not a finished palette. A simple approach is to generate a set, pick one color you love as the main color, then choose one or two others that work with it: a much lighter or darker color for backgrounds and text, and a contrasting accent for buttons and highlights. Generating a set in the Muted or Grays style gives you calm neutrals to pair with a vivid accent from another set. Keep the HEX codes of the colors you choose, so you can use exactly the same shades everywhere.

HEX, RGB and HSL in short

All three describe the same color in different ways. HEX is compact and common in web design. RGB lists the red, green and blue values as decimal numbers from 0 to 255, which some design apps prefer. HSL describes the hue as an angle around the color wheel, from 0 to 360 degrees, and the saturation and lightness as percentages, which makes it easy to adjust a color by hand, for example by raising the lightness for a paler tint.

Colors in print and on screen

Random colors are generated for screens, which mix red, green and blue light. Printers mix inks instead, so a very bright screen color may look duller on paper. If a color is going into print, check it in the color picker, which also shows the CMYK values, and ask your printer for a proof before a large print run. For fabrics and paints, compare against a physical swatch, because materials and lighting change how colors look.

Common mistakes

  • Using random colors for text without checking contrast.
  • Too many unrelated colors in one design. Pick two or three from a set.
  • Forgetting to save a set you like. Copy the codes before generating again.

What next

Use this often? Add Random Color to your Home screen.

Frequently asked questions

How does the random color generator pick colors?

For any color, it picks red, green and blue values from 0 to 255 at random. For styles like pastel or dark, it picks a random hue within set ranges of saturation and lightness.

How many colors can a HEX code describe?

16,777,216: 256 values for each of red, green and blue.

How do I copy a color?

Click its swatch to copy the HEX code, or use Copy all HEX codes for the whole set.

Can I get only pastel colors?

Yes. Choose Pastel as the style and every color will be light and soft.

Is the random color generator truly random?

It uses your browser's cryptographic random number generator where available, so every value is equally likely.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools