Color Converter
Convert colors between HEX, RGB, HSL, and CMYK formats
#6d28d9rgb(109, 40, 217)hsl(263, 70%, 50%)About This Tool
Convert any color between HEX, RGB, HSL and CMYK, preview it live, and copy ready-to-paste CSS color strings.
Translate a color into every common format
Designers, front-end developers and print designers often describe the same color in different ways. A brand guide may list a HEX code, a CSS file may use rgb() or hsl(), and a print shop asks for CMYK percentages. This converter keeps all four in sync: change any one value and the others, plus a large preview swatch, update immediately. Conversion is done with standard formulas in your browser.
How to use it
- Start from whatever you have. Type a HEX code (three or six digits, with or without
#), adjust the R, G and B fields (0 to 255), set H (0 to 360 degrees) with S and L (0 to 100%), or enter C, M, Y and K percentages. - Or click the color square next to the preview to choose a color with your system's color picker.
- Check the Color Preview swatch to confirm it looks right.
- Copy a full CSS string from the CSS Color Strings panel, for example
rgb(109, 40, 217)orhsl(263, 70%, 50%), or use the copy button on any individual format. - Click a swatch under Recent Colors to jump back to one of the last ten colors you used.
Understanding the four color models
| Format | What the numbers mean | Typical use |
|---|---|---|
| HEX | Red, green and blue as two hexadecimal digits each, from 00 to ff | CSS, design tools, brand guides |
| RGB | The same three channels as decimal numbers from 0 to 255 | CSS, image editing, code |
| HSL | Hue angle on the color wheel, saturation and lightness as percentages | Building palettes and tints in CSS |
| CMYK | Cyan, magenta, yellow and black ink coverage as percentages | Print preparation |
HEX and RGB are the same model written differently. In #6d28d9, 6d is red (109), 28 is green (40) and d9 is blue (217). A three-digit code such as #fa0 is shorthand where each digit is doubled, giving #ffaa00.
HSL rearranges RGB into something closer to how people think about color. Hue picks the position on the wheel (0 is red, 120 green, 240 blue), saturation controls how vivid it is, and lightness runs from black at 0% through the pure color at 50% to white at 100%. Keeping hue and saturation fixed while changing lightness is an easy way to make consistent lighter and darker shades.
CMYK is subtractive: it describes how much ink absorbs light on paper. The conversion here uses the standard mathematical formula, which is a good starting point but does not account for a specific printer, paper or ICC color profile. For final print work, confirm values with your print provider.
Tips
- HSL and CMYK values are rounded to whole numbers, so converting back and forth can shift a channel by one. Treat HEX or RGB as the source of truth when exact values matter.
- Transparency (alpha) is not part of this converter. Add it yourself, for example
rgb(109 40 217 / 50%)in modern CSS. - Need colors that work together? Try the palette generator. To grab a color from a photo or screenshot, use the image color picker and paste the HEX code here.
FAQ
Why does my printed color look different from the screen?
Screens emit light in RGB and can show colors that ink cannot reproduce. Bright saturated blues and greens are the usual casualties. The CMYK numbers are an approximation, not a guarantee.
Is HEX case sensitive?
No. #FFAA00 and #ffaa00 are identical. The tool outputs lower case.
Which format should I use in CSS?
All three CSS formats render the same. HEX is compact, while HSL makes it easier to reason about adjustments like "10% lighter".