What is the random color generator?
It's a tool that creates a random color every time you tap it and shows you its code in HEX and RGB, the two standard formats used in design and CSS. It paints a whole area with the color so you can see it large and copy the code with a tap.
It's perfect for finding inspiration when you don't know which color to use, discovering new combinations, or simply letting chance pick a palette for you.
What can a random color be used for?
- Web design and CSS: copy a color in HEX or RGB and paste it into your stylesheet.
- Creative inspiration: break away from your usual colors and discover new shades.
- Illustration and art: pick a random starting palette.
- Deciding between options by assigning a color to each.
- Games and challenges about guessing or matching colors.
How does it work?
Each color is generated by randomly choosing a value from 0 to 255 for each of the three channels (red, green and blue) with the browser's Math.random() function. The combination of those three values makes the final color, shown in HEX (#RRGGBB) and RGB. There are over 16.7 million possible colors, so a repeat is very unlikely.
The color code is computed and copied inside your browser; nothing is sent to any server. The history keeps the session's last colors in case you want them back.
Frequently asked questions
What is a HEX code?
It's the way to write a web color with a hash and six hexadecimal digits (#RRGGBB): two for red, two for green and two for blue. It's the most common format in CSS and design.
How do I copy the color?
Tap the HEX button or the RGB button and the code is copied to your clipboard, ready to paste into your editor, CSS or design tool.
How many colors can it generate?
Just over 16.7 million: 256 possible values for each channel (red, green and blue), that is 256 × 256 × 256 combinations.
Is it useful for web design and CSS?
Yes. It gives you the color in HEX and RGB, the two standard CSS formats, so you can paste it straight into your stylesheet or design tool.
Are the colors really random?
Yes. Each color channel is generated with the browser's pseudo-random engine, so each color is independent of the previous one. Everything happens in your browser.
What's the difference between HEX, RGB and HSL?
They're three ways of writing the same color. HEX (#RRGGBB) is the most used in web and design. RGB states the amount of red, green and blue (from 0 to 255). HSL uses hue, saturation and lightness, and is the most intuitive for lightening or darkening a color or finding similar shades. The tool gives you all three so you can copy whichever you need.