HEX, RGB and HSL Color Converter
Convert colors between HEX, RGB, HSL, HSV and CMYK, pick a color visually and check its WCAG contrast against white and black.
How to use it
- 01
Type a color in any format, or choose one with the color picker.
- 02
You’ll get the same color in HEX, RGB, HSL, HSV and CMYK, ready to copy.
- 03
Below that, check how it scores for contrast as text on a white and on a black background.
How it works
HEX and RGB describe the same thing: how much red, green and blue a color has, from 0 to 255. In HEX, each channel is written as two hexadecimal digits, so #2867D9 is red 40, green 103 and blue 217.
HSL (hue, saturation, lightness) and HSV are more intuitive for creating variations: change only the lightness and you get a lighter or darker shade of the same color. CMYK is an approximation for print; the actual result depends on the printer’s color profile.
Contrast is calculated with the WCAG 2 relative luminance formula. Normal text needs at least 4.5:1 to pass level AA and 7:1 for AAA; large text only needs 3:1.
Examples
- HEX to RGB
#2867D9 converts to rgb(40 103 217) and hsl(219 70% 50%).
- Checking accessibility
#2867D9 on white has a contrast ratio of 5.21:1, so it passes AA for normal text.
- A gray that just misses
#777777 on white comes in at 4.48:1, just under the 4.5:1 that AA requires.
Frequently asked questions
What do the last two digits in #RRGGBBAA mean?
They set the opacity (the alpha channel): 00 is fully transparent and FF is fully opaque. #00000080 is black at 50% opacity.
Why doesn’t the CMYK value match my design software?
Because an exact conversion depends on the color profile (SWOP, GRACoL, FOGRA…). This tool uses the straight mathematical formula, which is fine as a reference but not for print proofs.
Related tools
- 03.09
Binary, Decimal and Hex Converter
Converters - 10.02
QR Code Generator
Developer tools - 10.03
JSON Formatter and Validator
Developer tools - 10.01
UUID Generator
Developer tools - 10.04
Base64 Encoder and Decoder
Developer tools - 10.05
URL Encode and Decode
Developer tools - 10.06
MD5, SHA-1 and SHA-256 Hash Generator
Developer tools - 10.08
Unix Timestamp Converter
Developer tools