Savvy Calculator

Random Color Generator

Generate random colors and copy their HEX, RGB and HSL values for design and art projects.

Each color is three random values for red, green and blue, from 0 to 255. Every one of the 16.7 million colors is equally likely.

Random colors

Press Generate colors.

How the random color generator works

Press Generate to get one or more random colors. Each one is shown as a swatch with its HEX, RGB and HSL codes, ready to copy, and with its contrast ratio against white and black text, so you can see at a glance which text color is readable on it.

Each color is made from three random values for red, green and blue, each from 0 to 255, so every one of the 16.7 million possible colors is equally likely.

HEX, RGB and HSL

Screens make colors by mixing red, green and blue light. RGB writes the three amounts as numbers from 0 to 255; HEX writes the same three numbers in base 16, as a # followed by six digits; and HSL describes the color as a hue (an angle on the color wheel), a saturation and a lightness, which is easier for people to adjust.

One color in three formats
ColorHEXRGBHSL
Navy blue#1B4F8Argb(27, 79, 138)hsl(212, 67%, 32%)
Golden yellow#FFCC00rgb(255, 204, 0)hsl(48, 100%, 50%)
Medium grey#767676rgb(118, 118, 118)hsl(0, 0%, 46%)

Any of these can be pasted into CSS, such as color: #1B4F8A, or into most design tools.

Contrast and readable text

Contrast ratio compares how light two colors are, from 1:1 (identical) to 21:1 (black on white). The Web Content Accessibility Guidelines (WCAG) ask for at least 4.5:1 for normal text and 3:1 for large text, at level AA.

Example: Navy #1B4F8A has a contrast of 8.29:1 with white, so white text on it is easy to read, but only 2.53:1 with black. Golden yellow #FFCC00 is the opposite: 13.89:1 with black and just 1.51:1 with white. Medium grey #767676 is about the lightest grey that still reaches 4.5:1 against white (4.54:1); one step lighter, #777777, falls just short at 4.48:1.