Skip to main contentAgent-Native Hackathon winners revealed live Nov 13.RSVP
CONTACT SALESSTART BUILDING

Random color generator

Generate a random color with one click, with its name and hex, RGB or HSL code.

  • #30378Ddarkslateblue
or pressSpace
How many
1
Color family
Saturation
Lightness
or pressSpace
Recent
  • Colors you roll show up here.

Free and open source

Turn random colors intopages, ads and prototypes.

Agent-Native Design builds each one in the colors you rolled, with readable text on every background.

TRY AGENT-NATIVE DESIGN

Random hex colors in code

// A random hex color in JavaScript const randomHex = () => { const n = crypto.getRandomValues(new Uint32Array(1))[0] & 0xffffff; return "#" + n.toString(16).padStart(6, "0"); }; randomHex(); // e.g. "#3fa86b"

More free color tools

Color palette generatorCreate a palette in seconds, or build a light and dark theme from your brand color.Color wheelBuild a palette from any color's harmonies and copy it as CSS or Tailwind.Image color pickerGet the HEX, RGB and HSL code of any color in a photo, plus its main colors as a palette.Gradient generatorCreate beautiful gradients and export them as CSS, Tailwind or an image.Inverted color wheelFind the opposite of any color, invert an image and print a chart.Hex to RGBTurn a hex code into RGB, HSL, OKLCH, CMYK and Tailwind values.

FAQs

Random color questions

Press the spacebar or the New color button. Each press gives you a new random color with its name and hex code. Switch to RGB, HSL or OKLCH under the colors for the other codes.

Every color here shows its hex code. Click a color to copy it. To make one in code, pick a random number from 0 to 16,777,215 and write it in base 16, as the JavaScript and Python examples show.

Press the lock on it, or tab to it and press L. Locked colors stay put while the others change, and the page link keeps your locks.

Yes. Pick a family, such as blue, and every new color is blue. You can also ask for pale or vivid colors, or light or dark ones.

They come from your browser's cryptographic random number generator, the same kind used to make security keys. With no family or other rule set, every color has the same chance.

16,777,216. That's every color a standard screen can show, from #000000 to #FFFFFF.