Skip to content
nearnull

Random Color Generator

Generate random colors, any, pastel, vivid or dark, and copy them as HEX, RGB or HSL. Runs entirely in your browser. Nothing is sent to any server.

Options
Style
Output format
Random colors

Your colors will appear here

What is a random color generator?

A random color generator picks colors for you, which is useful when you need test data, placeholders or a fresh starting point. Any color draws red, green and blue independently from the full 16.7 million color range, so results are often muddy. The pastel, vivid and dark styles instead pick a random hue on the color wheel and keep saturation and lightness within a range, so every result has the same character. Randomness comes from the browser's cryptographic generator, and you can copy the colors as HEX, RGB or HSL.

Examples

Generating random colors in code:

JavaScript
const [r, g, b] = crypto.getRandomValues(new Uint8Array(3));
const hex = "#" + [r, g, b].map((v) => v.toString(16).padStart(2, "0")).join("");
JavaScript
// a random pastel: any hue, high lightness
const h = Math.floor(Math.random() * 360);
const pastel = `hsl(${h}, 70%, 85%)`;
Python
import secrets

hex_color = "#" + secrets.token_hex(3)
Bash
printf '#%06x\n' $((RANDOM * RANDOM % 16777216))

Use Cases

Placeholder and avatar colors

Give default avatars, tags or empty cards a distinct background each, using the pastel or vivid style so they all look consistent.

Test data and mockups

Fill fixtures, seed databases or prototypes with realistic color values in the format your code expects.

Breaking a creative block

Generate a batch and keep the ones you like as a starting point for an illustration, slide deck or brand exploration.

Games and generative art

Pick colors for sprites, particles or generated patterns, then reuse the list in your code.

Frequently Asked Questions

What do the styles do?
Pastel keeps lightness between 78% and 90% with medium to high saturation, vivid keeps saturation from 75% and lightness around the middle, and dark keeps lightness between 12% and 30%. Any color has no limits at all.
Are the colors truly random?
They come from crypto.getRandomValues, the browser's cryptographically secure generator, with rejection sampling so no value is favored. That's more than any color task needs, but it costs nothing.
Why does changing the format keep the same colors?
The format only changes how the colors are written. Changing the quantity or the style, or pressing Generate, draws a new set.
Can I generate a matching palette instead?
Random colors don't try to match each other. For colors that work together, use the Color Palette Generator, which builds harmonies from one base color.
Is my data sent to a server?
No. The colors are generated in your browser with plain JavaScript. Nothing is transmitted or stored.