Skip to main content

DigitalCalculators.net

Random Color Generator

Last updated By the DigitalCalculators.net team Free, no sign-up

Generate random colors with their HEX, RGB and HSL codes. Choose any color, pastel, dark, vivid or gray tones, and click a swatch to copy its code.

Results

HEXRGBHSL
Colors are made from secure random numbers (crypto.getRandomValues). Any color picks red, green and blue values from 0 to 255; the other types pick hue, saturation and lightness within set ranges. Click a swatch to copy its HEX code. Nothing is saved.

Quick Answer

Press Generate for 6 random colors, each with its HEX, RGB and HSL code. Choose Pastel for soft light colors, Vivid for bright ones, Dark for deep shades or Grays for neutral tones. Click any swatch to copy its HEX code, and press Generate again for a fresh set.

Last updated: 15 November 2026 ·How we calculate this: how random colors are made

How This Random Color Generator Works

Random colors are great for breaking a creative block, testing designs, or picking a color you would never have chosen yourself. This generator makes up to 24 colors at once and shows each as a swatch with its codes, ready to copy into a design tool, stylesheet or paint app.

Color types:

  • Any: fully random red, green and blue values.
  • Pastel: light, soft colors.
  • Vivid: bright, highly saturated colors.
  • Dark: deep shades, good for backgrounds.
  • Grays: neutral tones from near black to near white.

How to Use the Random Color Generator

  1. Enter how many colors you want.
  2. Choose the type of color.
  3. Press Generate.
  4. Click a swatch to copy its HEX code.
  5. Press Generate again for new colors.

How Random Colors Are Made

  • Any color: red, green and blue are each a random whole number from 0 to 255, giving 256 × 256 × 256 = 16,777,216 possible colors.
  • Other types: hue is random from 0 to 360°, while saturation and lightness stay in a range, such as lightness 80% to 90% for pastels.
  • HEX: each RGB value is written as two hex digits.
  • HSL: the same color as hue, saturation and lightness.

Key Terms

  • HEX code: a color written as # and six hex digits.
  • RGB: red, green and blue values from 0 to 255.
  • HSL: hue, saturation and lightness.
  • Pastel: a light, soft, low-intensity color.

Worked Example

A random color comes out as RGB 46, 139, 87.

  • HEX: 46 = 2E, 139 = 8B, 87 = 57, so #2E8B57.
  • HSL: about hsl(146, 50%, 36%), a sea green.
  • Its lightness is below 60%, so the swatch label is white for contrast.

Real-Life Examples

  • Design inspiration: 12 random pastels to start a moodboard.
  • Data charts: a few vivid colors for chart series.
  • Games and art: pick a random color to paint or draw with.
  • Testing: random backgrounds to check how a layout looks.

Random Colors vs a Color Palette

  • Random colors: each color is picked on its own, so they may not match.
  • Color palette: colors are chosen to go together, using color harmony rules.

To build matching colors, use the Color Palette Generator.

Color Type Ranges

Hue is random from 0° to 360° for all types except grays.

TypeSaturationLightness
Pastel45% to 80%80% to 90%
Vivid85% to 100%45% to 55%
Dark40% to 90%12% to 30%
Grays0%8% to 92%

Tips for Using Random Colors

  • Start from a lucky pick: use one random color as the base for a full palette in the Color Palette Generator.
  • Check contrast: test text colors with the Color Picker’s contrast check.
  • Pastels for backgrounds: they keep text readable.
  • Vivid for accents: use them sparingly for buttons and highlights.

Common Mistakes to Avoid

  • Using random colors for text without checking contrast. Some will be hard to read.
  • Expecting the colors to match. Use a palette tool for matching colors.
  • Too many vivid colors together. They compete for attention.
  • Judging on one screen. Colors vary between displays.
  • Forgetting the code. Copy the HEX code before generating again.

Frequently Asked Questions

Press Generate. Each color shows its HEX, RGB and HSL codes.

16,777,216 with Any color, because each of red, green and blue has 256 values.

Yes. Choose Pastel.

Click the swatch to copy its HEX code.

Yes. Choose Dark.

Not necessarily. Use the Color Palette Generator for matching colors.

No. Colors are made in your browser.

Up to 24.

It uses your browser’s secure random generator.

Yes. Copy the HEX code, such as #2E8B57, or the hsl() value, and paste it straight into your stylesheet.

Pastels are light and soft by design. Choose Vivid for strong, bright colors instead.

They describe the same color in two ways. RGB lists red, green and blue as numbers from 0 to 255, while HEX writes the same three numbers as two-digit hexadecimal codes, such as 2E for 46.

A random color can be a great starting point. Generate a few, pick the one you like, then build matching shades with the Color Palette Generator and check contrast before you commit.

The label switches to white on dark colors and black on light colors, so the code is always easy to read.

Copy its HEX code before pressing Generate, because each press makes a completely new set of random colors.

Not always. Screens show RGB colors, while printers use CMYK inks, so very bright screen colors can look duller on paper. Ask your printer to match the color if it matters.

References & Sources

SourceUsed ForLink
W3C, CSS Color Module Level 4 HEX, RGB and HSL color formats. https://www.w3.org/TR/css-color-4/
MDN Web Docs, Crypto.getRandomValues() The secure random source used for colors. https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues

Cite or share this calculator

DigitalCalculators.net. (2026, November 15). Random Color Generator. https://digitalcalculators.net/random-color-generator/