How a random color is picked
A hex color code is three numbers from 0 to 255, for red, green and blue light, each written as two hexadecimal digits (00 to FF). That makes 256 × 256 × 256 colors. This page takes three random bytes from your browser’s cryptographic random generator, one for each, so every color is exactly equally likely:
Here it is with your numbers:
- Possible colors = 256 × 256 × 256
- Possible colors = 16,777,216
- First color’s bytes (red, green, blue) = 37, 99, 235
- Hex code = #2563EB
It means #2563EB had the same 1 in 16,777,216 chance as every other color.
Because every color is equally likely, most picks are in-between shades rather than the bright, named colors people usually think of. Nothing is left out or nudged towards “nice” colors.
Source W3C · CSS Color Module Level 4, §5.2 The RGB hexadecimal notations ↗W3C · Web Cryptography Level 2, the Crypto interface ↗
Random color generator examples
| To pick | Settings |
|---|---|
| One color | 1 color |
| Three colors for a logo or poster | 3 colors |
| Seven colors | 7 colors |
| 24 colors for a game or chart test | 24 colors |
FAQs
What are random colors?
Colors picked by chance instead of chosen. Here every one of the 16,777,216 colors a 6-digit hex code can name is equally likely, so you get pale, dark and muddy colors as often as bright ones.
Source W3C · CSS Color Module Level 4, §5.2 The RGB hexadecimal notations ↗
What color is 999999?
#999999 is rgb(153, 153, 153), a medium gray. Red, green and blue are all equal, as in CSS’s own gray (#808080), and 153 is 60% of the way from 0 to 255, so it is lighter than that gray.
Can you give me 7 random colors?
Yes: set How many colors to 7. Each of the 7 is drawn on its own from all 16,777,216 colors, by your browser’s cryptographic random generator.
Source W3C · Web Cryptography Level 2, the Crypto interface ↗
Sources
- W3C: CSS Color Module Level 4, §5.2 The RGB hexadecimal notations
- W3C: CSS Color Module Level 4, §6.1 Named colors
- W3C: Web Cryptography Level 2, the Crypto interface