Skip to main content
CalcChef

Color Picker

Pick a color or type a HEX, RGB or HSL value to get the other two, the CSS and CMYK forms, and its WCAG contrast ratio on white, black or a second color. How it works

Use the Color Picker

RGB (CSS)
rgb(59 130 246)
HSL (CSS)
hsl(217 91% 60%)
CMYK
cmyk(76%, 47%, 0%, 4%)

HSL is rounded to whole numbers; HEX and RGB are exact.

Contrast

WCAG 2.x contrast ratio of #3B82F6 against white, black and a second color. AA needs 4.5 (normal text) or 3 (large text); AAA needs 7 or 4.5.

AgainstRatioAA normal (4.5)AA large (3)AAA normal (7)AAA large (4.5)
On white #FFFFFF3.68:1FailPassFailFail
On black #0000005.71:1PassPassFailPass
On your second color #0F172A4.85:1PassPassFailPass

About the Color Picker

Pure red is #FF0000 in HEX, rgb(255, 0, 0) in RGB and hsl(0, 100%, 50%) in HSL: three ways of writing one color. Pick a color or type any of the three forms into this color picker and it fills in the other two, the CSS and CMYK forms, and the WCAG contrast ratio against white, black and a second color.

The 16 basic web colors: HEX, RGB, HSL and contrast

ColorHEXRGBHSLContrast on whiteAA text on whiteContrast on blackAA text on black
black#000000rgb(0, 0, 0)hsl(0, 0%, 0%)21.00:1Pass1.00:1Fail
silver#C0C0C0rgb(192, 192, 192)hsl(0, 0%, 75%)1.82:1Fail11.54:1Pass
gray#808080rgb(128, 128, 128)hsl(0, 0%, 50%)3.95:1Fail5.32:1Pass
white#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)1.00:1Fail21.00:1Pass
maroon#800000rgb(128, 0, 0)hsl(0, 100%, 25%)10.95:1Pass1.92:1Fail
red#FF0000rgb(255, 0, 0)hsl(0, 100%, 50%)4.00:1Fail5.25:1Pass
purple#800080rgb(128, 0, 128)hsl(300, 100%, 25%)9.42:1Pass2.23:1Fail
fuchsia#FF00FFrgb(255, 0, 255)hsl(300, 100%, 50%)3.14:1Fail6.70:1Pass
green#008000rgb(0, 128, 0)hsl(120, 100%, 25%)5.14:1Pass4.09:1Fail
lime#00FF00rgb(0, 255, 0)hsl(120, 100%, 50%)1.37:1Fail15.30:1Pass
olive#808000rgb(128, 128, 0)hsl(60, 100%, 25%)4.20:1Fail5.01:1Pass
yellow#FFFF00rgb(255, 255, 0)hsl(60, 100%, 50%)1.07:1Fail19.56:1Pass
navy#000080rgb(0, 0, 128)hsl(240, 100%, 25%)16.01:1Pass1.31:1Fail
blue#0000FFrgb(0, 0, 255)hsl(240, 100%, 50%)8.59:1Pass2.44:1Fail
teal#008080rgb(0, 128, 128)hsl(180, 100%, 25%)4.77:1Pass4.40:1Fail
aqua#00FFFFrgb(0, 255, 255)hsl(180, 100%, 50%)1.25:1Fail16.75:1Pass

The names and HEX values are the 16 basic CSS color keywords. “AA text” is the WCAG level AA test for normal-size text, which needs at least 4.5:1. For a color you enter, the picker also shows AA for large text (3:1) and AAA for normal and large text (7:1 and 4.5:1). The picker takes HEX, RGB or HSL input, not color names.

Frequently asked questions

How do I convert HEX to RGB?
Split the six digits into three pairs and read each pair as a base-16 number from 0 to 255. #FF8800 is FF = 255, 88 = 136 and 00 = 0, so rgb(255, 136, 0). A three-digit code doubles each digit: #fff is #ffffff.
What is the difference between RGB and HSL?
RGB gives the amounts of red, green and blue, each from 0 to 255. HSL describes the same color as a hue angle from 0 to 360, a saturation and a lightness from 0 to 100%. #1E90FF is rgb(30, 144, 255) or hsl(210, 100%, 56%). HSL is the easier one to adjust by hand, because lowering the last number darkens the color without changing its hue.
What contrast ratio does text need?
WCAG 2.2 level AA asks for at least 4.5:1 for normal text and 3:1 for large text, meaning 18 point, or 14 point bold. Level AAA asks for 7:1 and 4.5:1. The picker shows pass or fail for all four.
Does #777777 pass contrast on white?
No. #777777 on white is 4.48:1, just under the 4.5:1 that AA needs for normal text. #767676 is 4.54:1 and passes. WCAG says the computed ratio is not to be rounded up to meet a threshold.
Can I enter a color with transparency?
Yes. Paste rgba(), hsla() or a 4- or 8-digit HEX value and the alpha, kept to two decimals, appears in three extra rows: #3b82f680 gives #3B82F680, rgba(59, 130, 246, 0.5) and hsla(217, 91%, 60%, 0.5). The swatch, the HEX, RGB and HSL fields and the contrast figures use the opaque color.
How is CMYK calculated?
With the plain formula: K = 1 − the largest of R, G and B as a fraction, then C, M and Y from what is left. #3B82F6 gives cmyk(76%, 47%, 0%, 4%). No color profile is applied, so do not use the figures for print proofs.

Related Tools

View all tools