Color Converter

Convert colors between HEX, RGB and HSL and pick a color visually.

Contrast with white–
Contrast with black–
Best text color–

How to convert a color

Pick a color or type a value into any of the HEX, RGB or HSL boxes; the other formats update immediately. Accepted forms include #4338ca, rgb(67, 56, 202) and hsl(245, 58%, 51%). Copy the format your CSS, design tool or code needs.

Checking readability

The contrast figures use the WCAG 2 relative-luminance formula. Use the suggested text color to keep labels on a colored button or banner readable.

Frequently asked questions

What is the difference between HEX, RGB and HSL?

They describe the same colors in different ways. HEX and RGB give the red, green and blue amounts (HEX in base 16). HSL gives hue as an angle on the color wheel plus saturation and lightness, which is easier to adjust by hand.

What does the contrast ratio mean?

It is the WCAG measure of how readable text is against a background, from 1:1 to 21:1. Normal text needs at least 4.5:1 to meet level AA.

Can I enter a 3-digit HEX code?

Yes. Short codes such as #0af are expanded to #00aaff.

Related tools