Random Color Generator

Share randomizer:
Embed this tool:

Draw one to twelve random colors and get the HEX, RGB and HSL values for each. Choose from every possible color or from a compact palette of red, blue, black, white and color-wheel hues.

Using the random color generator

  1. Enter how many colors you want, from 1 to 12.
  2. Under Choose from, pick all colors or one of the smaller palettes described below.
  3. Leave Unique colors only ticked if no color may appear twice. Clear it to allow repeats.
  4. Press Pick a Random Color. Each color is listed with its HEX code, its RGB values and its HSL values, and each value has its own copy button.

The copy button gives the value in a form you can paste straight away: the HEX code with its #, the RGB triple as 58,123,213, and the HSL triple as hue, saturation and lightness separated by commas.

What are HEX, RGB and HSL colors?

A screen color is a mix of red, green and blue light, and the three notations are different ways of writing the same mix.

  • RGB lists the strength of the red, green and blue channels, each a whole number from 0 (off) to 255 (full).
  • HEX writes those three numbers in base 16 and joins them after a #. The pair 3a is 3 × 16 + 10 = 58, so 3a7bd5 means red 58, green 123, blue 213.
  • HSL describes the same color the way people think of it: hue is the angle around the color wheel from 0 to 360 degrees, saturation says how vivid it is, and lightness says how close it is to black or white. This tool prints saturation and lightness as fractions between 0 and 1, rounded to two decimals.

With the largest and smallest channel values written as fractions of 255 (call them max and min), lightness and saturation come from:

L = (max + min) ÷ 2

S = (max − min) ÷ (1 − |2L − 1|)

The hue depends on which channel is largest: it is 60 × (G − B) ÷ (max − min) when red leads, 60 × ((B − R) ÷ (max − min) + 2) when green leads and 60 × ((R − G) ÷ (max − min) + 4) when blue leads, with 360 added if the result is negative.

Example: #3a7bd5 is R 58, G 123, B 213. Then max = 213 ÷ 255 = 0.8353 and min = 58 ÷ 255 = 0.2275, so L = 0.5314 and S = 0.6078 ÷ 0.9373 = 0.6485. Blue is the largest channel, so H = 60 × ((58 − 123) ÷ 255 ÷ 0.6078 + 4) = 214.84. The generator would show this color as H: 214.84 S: 0.65 L: 0.53.

Choosing a palette

All colors draws red, green and blue independently from 0 to 255, so each of the 256 × 256 × 256 = 16,777,216 colors is equally likely. The other options draw from short fixed lists:

OptionColors in the palette
Red or blue#ff0000, #0000ff
Red or black#ff0000, #000000
Black or white#000000, #ffffff
3-color wheelred #ff0000, blue #0000ff, yellow #ffff00
6-color wheelthe three above plus orange #ff7f00, green #007900 and purple #ba00ff
12-color wheelthe six above plus #ff4600, #feb300, #00ff00, #00aeae, #7308a5 and #cc00af

The wheels follow the traditional painter's wheel: three primaries, then the secondaries between them, then the in-between hues. Their hues are therefore not evenly spaced in RGB terms, which is why the 12-color list includes two greens at the same 120 degree hue (#00ff00 and the darker #007900).

Unique colors and limits

Unique colors only matters when you pick more than one. It is handy for giving each player in a game a different color. A palette can only supply as many unique colors as it contains, so asking for 5 unique colors from the 3-color wheel shows an error; choose a bigger palette or clear the box.

In all-colors mode the box is almost academic. Even with 12 colors, the chance that any two coincide is roughly 12 × 11 ÷ 2 ÷ 16,777,216, about 4 in a million.

Tips for using random colors

Because every color in the full cube is equally likely, you will see plenty of muted, middling colors and very few fully saturated ones. When you want clear, vivid hues, pick from one of the wheels instead. If a color will carry text, check its contrast before you commit: the Web Content Accessibility Guidelines ask for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text.

Other generators worth a look: the random picker for choosing between your own options, the random month generator and the random country generator.

Frequently asked questions

How many colors can the generator produce?

In all-colors mode there are 16,777,216 possible colors, one for every combination of red, green and blue values from 0 to 255.

How do I use the HEX code in CSS?

Paste it as it appears, for example color: #3a7bd5. The RGB result can be written as rgb(58, 123, 213). For hsl(), keep the hue in degrees and multiply the saturation and lightness fractions by 100 to get percentages, for example hsl(214.84, 65%, 53%).

Why do I get an error about unique colors?

You asked for more distinct colors than the chosen palette holds. Reduce the number, pick a larger palette, or untick Unique colors only.

Is each color equally likely?

Yes. In all-colors mode every one of the 16.8 million colors has the same probability, and in a palette every entry does.

References

  1. W3C, CSS Color Module Level 4
  2. W3C, Web Content Accessibility Guidelines (WCAG) 2.2

Cite this randomizer and page

If you use this page in your work, you can cite it as:

Reeliy Editorial Team. (2026). Random Color Generator. Reeliy. https://reeliy.com/randomizers/random-color-generator“Random Color Generator.” Reeliy, 2026, https://reeliy.com/randomizers/random-color-generator.