Random Color Generator

Generate beautiful, crisp random colors instantly. One-click copy for HEX, RGB, and HSL.

DARK TONE
#7C3AEDrgb(124, 58, 237)•hsl(262°, 83%, 58%)
Click HEX to copy
Tap canvas to generate

WCAG 2.1 Contrast Checker

The Math Behind the Contrast Ratios
Against White (#FFFFFF)
5.7:1

Heading Sample (18pt+)

Regular body text readability test

AA: PASSAAA: FAILBadge: AA
Against Dark (#0F172A)
3.13:1

Heading Sample (18pt+)

Regular body text readability test

AA: FAILAAA: FAILBadge: AA Large
Standard: (L1 + 0.05) / (L2 + 0.05) based on sRGB relative luminance linearization.Read the author's deep-dive: "I added a WCAG contrast checker... here's the math" ↗

Recently Generated Colors

Random Color Palette

Open Full Tool

Explore Color Tools & Browser Companion

What Is a Random Color Generator?

A random color generator is a digital utility that algorithmically computes unpredictable color values across the sRGB and chromatic spectrum. Whether you need a sudden burst of creative inspiration for your user interface, mock data placeholders for graphic prototyping, or randomized themes for video games, Random Color Generator generates colors with mathematical speed and absolute precision.

Unlike static color charts, our online generator gives you direct access to 16,777,216 distinct 24-bit TrueColor hues with instant one-click copying for web development and graphic design workflows.

HEX vs RGB vs HSL: Which Color Model Should You Use?

Modern web browsers and graphic software support various color representation standards. Here is how they compare:

HEX (#RRGGBB)

Base-16 hexadecimal notation consisting of 6 digits. It is the most compact and widely used format in CSS stylesheets, Figma, and brand identity manuals.

RGB (rgb(r, g, b))

Specifies intensity levels from 0 to 255 across Red, Green, and Blue light channels. Ideal for canvas manipulation, programmatic pixel shaders, and CSS opacity adjustments.

HSL (hsl(h, s%, l%))

Hue (0–360°), Saturation (0–100%), and Lightness (0–100%). HSL is intuitive for humans: tweak lightness for hover states without altering the base hue.

How to Generate Random Colors in JavaScript & CSS

If you want to create random colors in your own frontend code, you can use these tested snippets:

// Generate a random HEX color in 1 line of JavaScript
const getRandomHex = () => '#' + Math.floor(Math.random() * 0xffffff).toString(16).padStart(6, '0');

// Apply directly to any HTML element:
document.body.style.backgroundColor = getRandomHex();

Frequently Asked Questions

How do I generate a new color using keyboard shortcuts?▼

Simply press the SPACEBAR anywhere on the page to immediately produce a fresh random color.

Can I share the generated color with a coworker or friend?▼

Yes! Click the Share button on the color canvas. It copies a direct URL (e.g. /?color=7C3AED) that reloads the exact same shade on any device.

Is Random Color Generator free to use for commercial projects?▼

100% yes. All color values, CSS code snippets, and palettes generated on this site are free for personal, educational, and commercial work with zero attribution required.

Is there a video tutorial or walkthrough on YouTube?▼

Yes! Check out our official humorous video guide on YouTube: Watch "Do NOT Use This Website!" on YouTube ↗, demonstrating keyboard shortcuts, palette locking, and instant CSS extraction.

How does Random Color Generator calculate WCAG contrast ratios?▼

We calculate relative luminance following the official W3C WCAG 2.1 standard: 8-bit sRGB values are linearized by stripping gamma compression, weighted against human photopic spectral sensitivity (0.2126R + 0.7152G + 0.0722B), and evaluated using (L1 + 0.05) / (L2 + 0.05). For an in-depth mathematical walkthrough and full code implementation, read our author's technical write-up: "I added a WCAG contrast checker to a random color generator: here's the math" on Hashnode ↗.

Color Knowledge Base

Trending Color Combinations & Palettes

Explore curated color combinations, verified HEX standards, and harmonious palettes with live UI simulations.