RGB Color Converter
Convert a colour into HEX, rgb()/rgba(), percentages, HSL, HSV and CMYK at once: accepts rgb(), HEX, hsl(), hsv(), cmyk() and bare numbers, with a live preview swatch, WCAG relative luminance, a suggested foreground colour and batch input.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Accepts HEX (#f00 / #ff0000 / #ff0000ff), rgb()/rgba(), percentage channels, bare numbers, plus hsl()/hsv()/hsb()/cmyk().
Result
One result per line, ready to copy.
Enter a colour to see the result
What this tool does
- See every notation of a colour before writing CSS: HEX, rgb(), percentages, HSL, HSV and CMYK in one pass.
- Pick a readable text colour for a swatch: the tool computes WCAG relative luminance and suggests black or white.
- Mix sources in one box: a designer hsl(), a printer cmyk() and a front-end hex can all be pasted together.
Example
Input
#336699
Output
HEX #336699 RGB rgb(51, 102, 153) HSL hsl(210, 50%, 40%) HSV hsv(210, 66.7%, 60%) CMYK cmyk(66.7%, 33.3%, 0%, 40%)
Every line is derived from the same RGB triple, so the hex, hsl() and cmyk() values agree exactly.
Frequently asked questions
Which CMYK profile is used?
The standard black-plate formula: K = 1 − max(R,G,B)/255 and C = (1 − R/255 − K) / (1 − K). Pure black therefore becomes cmyk(0%, 0%, 0%, 100%). Use the RGB and CMYK converter for the pure CMY profile.
How is the suggested foreground colour chosen?
WCAG 2.x relative luminance is computed (sRGB converted to linear light); above 0.179 black text is suggested, otherwise white. It is a quick heuristic, and a formal accessibility check still needs the contrast ratio.
Can the four notations clash?
No. Parsing order is functional notation (rgb/hsl/hsv/cmyk), then #-prefixed hex, then bare hex, and only then bare numbers, so 51,102,153 is RGB while #336699 is hex.
Does it support batch input?
Yes, one colour per line. Blank lines are skipped, failing lines are listed with an error code, and successful lines are still output.
Keywords:hslhsvcmykcolor converterrgb to hexcolour formats