Random Color Generator
About this tool
About Random Color Generator
Need a colour for a placeholder, a test fixture, a chart series or just a spark of inspiration? Generate up to 40 random colours at once and copy any of them with one click. Fully random colours pick every RGB value with equal chance, which often gives muddy results, so you can also choose a style: vibrant, pastel, muted, light, dark, warm, cool or greyscale. Each style keeps hue random but limits saturation and lightness to a range that looks right for it. Colours come in your choice of HEX, RGB, HSL or OKLCH, and the whole batch is shown as a palette strip that you can copy as CSS custom properties. Randomness comes from your browser's cryptographic generator, so batches don't repeat in patterns. Press New colours for a fresh set at any time, download the list as a text file, and nothing is sent anywhere.
Built and maintained by Abhi JainUpdated
How to Generate Random Colours
- 1
Set the options
Choose How many, a Style such as Pastel, and a Format.
- 2
Generate
Press New colours until you like the set.
- 3
Copy
Copy a single colour, Copy all, or Copy CSS variables from the palette strip.
Random Color Generator: questions and answers
How do I generate a random hex colour in JavaScript?
One common way is '#' + Math.floor(Math.random() * 0x1000000).toString(16).padStart(6, '0'). The padStart matters: without it, small numbers give invalid five-digit codes.
How are pastel colours generated?
Pastels use a random hue with fairly high saturation (60–95%) and high lightness (80–90%) in HSL, which gives soft, light colours that still have a clear hue.
How many colours can a hex code represent?
16,777,216: each of red, green and blue has 256 levels, and 256 × 256 × 256 = 16,777,216.
Can I get a palette instead of unrelated colours?
For colours that work together, use the Color Palette Generator, which builds harmonies and scales from one colour.
Related Tools
- Color Palette GeneratorColour harmonies, tints and shades and a 50–950 scale, exported as CSS, Tailwind, JSON or PNG.
- Color Picker & ConverterPick a colour and convert it between HEX, RGB, HSL, HSV, OKLCH, CMYK and CSS names.
- CSS Gradient GeneratorLinear, radial and conic CSS gradients with a live preview.
- Color Contrast CheckerCheck WCAG 2.2 AA and AAA contrast for text and UI, and get the nearest passing colour.