Random Color Generator
The random color generator picks one of the 16,777,216 six-digit HEX colors, each with the same chance, and shows it as HEX, RGB and HSL. Press the button for a new color and click a value to copy it.
Updated
How the random color generator picks a color
The page draws six hexadecimal digits, each from 0 to F with equal chances, and puts them together as a color code such as #3FA2C8. Each digit is like a roll of a 16-sided die, the same kind of draw the random number generator makes for 0 to 15.
Six digits give 16,777,216 possible codes, and every one has the same chance. Each pick is an unbiased draw from the browser's cryptographic random generator, as described in how our randomness works.
HEX, RGB and HSL: one color in three notations
The same color is shown in the three notations defined in the CSS Color standard. Click a value to copy it into a stylesheet or a design tool.
| Notation | Example | Meaning |
|---|---|---|
| HEX | #3FA2C8 | Red, green and blue as two hexadecimal digits each |
| RGB | rgb(63, 162, 200) | Red, green and blue from 0 to 255 |
| HSL | hsl(197, 55%, 52%) | Hue in degrees, saturation and lightness in percent, rounded |
How to convert a HEX color to RGB: a worked example
The page does this conversion for every color it draws. By hand, #3FA2C8 works out like this:
- Split the code into three pairs: 3F for red, A2 for green and C8 for blue.
- Turn each pair into a number from 0 to 255: the first digit times 16, plus the second digit, with A to F standing for 10 to 15. 3F is 3 × 16 + 15 = 63.
- Do the same for the other two pairs: A2 is 10 × 16 + 2 = 162 and C8 is 12 × 16 + 8 = 200.
- Write the three numbers in order: rgb(63, 162, 200).
Why random colors often look muddy
Because the draw is even across all codes, many results are dark or greyish mid-tones, and bright, clean colors are a small part of the whole space. Draw a few times if you are after a palette.
To choose between a few colors you like, paste their HEX codes into the picker wheel and spin. For a drawing idea that comes with a color, try the art prompt generator, and to put your colors on a banner, use the flag generator.
Questions about the random color generator
How many colors can the random color generator produce?
16,777,216. A HEX color has six digits and each digit has 16 possible values, so there are 16 × 16 × 16 × 16 × 16 × 16 codes. That is the same as 256 levels each of red, green and blue.
Can the same color come up twice?
Yes, but you will almost never see it. Each press is a new draw from all codes, so the chance that the next color repeats the last one is 1 in 16,777,216.
Are pure white and pure black possible?
Yes. #FFFFFF and #000000 are two of the 16,777,216 codes and each has the same 1 in 16,777,216 chance as any other color.
Sources
- W3C: CSS Color Module Level 4 — the standard that defines HEX, rgb() and hsl() color notation (checked October 16, 2026)
- Wikipedia: Hexadecimal — base 16, the digits 0 to 9 and A to F (checked October 16, 2026)