Home › Color Converter and Contrast Checker

Color Converter and Contrast Checker

Enter a color in any common CSS notation to get the other formats, a live swatch and the contrast ratio that tells you whether text on it is readable.

Results

Hex
#1e90ff
RGB
rgb(30, 144, 255)
HSL
hsl(210, 100%, 56%)
Relative luminance
0.2744
Contrast on white
3.24 : 1 (AA for large text only)
Contrast on black
6.49 : 1 (AA)
More readable text color
Black

How it works

The color is parsed into red, green and blue values from 0 to 255 plus an optional alpha. HSL is derived from those values by the standard formulas. For contrast, each channel is linearized, the relative luminance is computed with the WCAG weights, and the ratio against white and against black is calculated.

Rules and details

Worked example

The color #1e90ff is rgb(30, 144, 255) in RGB and hsl(210, 100%, 56%) in HSL. Its contrast is 3.24:1 on white and 6.49:1 on black, so it passes AA for large text on white and for normal text on black.

Frequently asked questions

Which contrast ratio should I aim for?

WCAG asks for at least 4.5:1 for normal body text and 3:1 for large text (about 24 px, or 19 px bold). 7:1 meets the stricter AAA level.

Are named colors supported?

Only the 16 basic CSS names such as red, navy and teal. Use HEX, RGB or HSL for anything else.

Why can the HEX value differ slightly after a round trip through HSL?

HSL values are rounded to whole numbers, so converting back can shift a channel by one. The tool always shows the exact values of your input.

Tips

Related tools

All tools