How to use it
- Paste or type any colour code – #ff8800, f80, rgb(255 136 0), hsl(32, 100%, 50%), hsv(…), cmyk(…) or a name such as darkorange.
- Or choose a model under “Edit as” and move the sliders or type the channel values; the preview and every code update live.
- Copy the HEX, RGB, HSL, HSV or CMYK string in modern CSS syntax (the legacy comma form is shown underneath), or copy them all.
- Check the contrast line to pick black or white text on that background, and share the link to the exact colour.
Example
rgb(255, 136, 0): 255 = ff, 136 = 8 × 16 + 8 = 88, 0 = 00, so the hex code is #ff8800. The channel maximum is red (1.0) and the minimum blue (0), so lightness is (1 + 0) / 2 = 50 %, saturation 100 % and the hue 60° × (136/255) ≈ 32°: hsl(32, 100%, 50%). In CMYK the black key is 1 − 1.0 = 0 %, magenta is 1 − 136/255 = 47 % and yellow 100 %: cmyk(0%, 47%, 100%, 0%). No CSS keyword is exactly #ff8800; the closest is darkorange (#ff8c00), four RGB steps away.
Formulas
HEX: each channel 0–255 → two hex digits (e.g. 136 → 88)
HSL: M = max(R,G,B)/255, m = min(R,G,B)/255, L = (M+m)/2
S = (M−m) / (1 − |2L−1|), H from the dominant channel (60° sectors)
HSV: V = M, S = (M−m)/M
CMYK: K = 1−M, C = (1−R/255−K)/(1−K), M = (1−G/255−K)/(1−K), Y = (1−B/255−K)/(1−K)
Luminance: L = 0.2126·R′ + 0.7152·G′ + 0.0722·B′ (channels linearised from sRGB); contrast = (L₁+0.05)/(L₂+0.05)RGB, HEX, HSL and HSV are lossless re-arrangements of the same sRGB value; converting round-trips to the identical colour. The CMYK numbers are the naive formula used by most on-screen tools, not a profiled conversion – a print shop with an ICC profile (FOGRA, SWOP) will produce different, usually lower, ink percentages. Alpha/opacity is not converted. Hue is reported in degrees and saturation, lightness, value and ink coverage in percent, rounded to one decimal.
Common colours
| Name | HEX | RGB | HSL |
|---|---|---|---|
| red | #ff0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| orange | #ffa500 | rgb(255, 165, 0) | hsl(39, 100%, 50%) |
| yellow | #ffff00 | rgb(255, 255, 0) | hsl(60, 100%, 50%) |
| lime | #00ff00 | rgb(0, 255, 0) | hsl(120, 100%, 50%) |
| green | #008000 | rgb(0, 128, 0) | hsl(120, 100%, 25.1%) |
| cyan | #00ffff | rgb(0, 255, 255) | hsl(180, 100%, 50%) |
| blue | #0000ff | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
| magenta | #ff00ff | rgb(255, 0, 255) | hsl(300, 100%, 50%) |
| gray | #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50.2%) |
| white | #ffffff | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| black | #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
Sources: W3C – CSS Color Module Level 4 (hex, rgb(), hsl(), named colours), W3C – WCAG 2.1, relative luminance and contrast ratio, Wikipedia – HSL and HSV.
Which syntax should I use in CSS?
All modern browsers accept the space-separated form, rgb(255 136 0) and hsl(32 100% 50%), with an optional “/ alpha”; the comma form rgb(255, 136, 0) still works everywhere. Hex is the shortest and most portable (#ff8800, or #ff880080 with 50 % alpha). HSL is the easiest to adjust by hand – change only the lightness for a hover shade – which is why design systems often define palettes in it.
Questions
- How do I convert RGB to HEX by hand?
- Divide each channel by 16: the quotient is the first hex digit and the remainder the second, using a–f for 10–15. 136 ÷ 16 = 8 remainder 8 → 88; 255 → ff; 0 → 00. Join them with a # in front.
- What is the difference between HSL and HSV?
- Both use the same hue. HSL’s lightness goes from black (0 %) through the pure colour (50 %) to white (100 %); HSV’s value is the brightness of the strongest channel, so a pure colour has V = 100 % and white also has V = 100 % but S = 0 %. Design tools such as Photoshop show HSB, which is HSV.
- Why do my CMYK values differ from Photoshop’s?
- Photoshop converts through a colour profile (for example U.S. Web Coated SWOP), which models real inks and paper. This tool uses the simple formula without a profile, which is fine for a quick estimate but not for print-ready separations.
- Does the converter handle transparency?
- It reads rgba(), hsla() and 8-digit hex codes but ignores the alpha channel. Add the opacity yourself, e.g. rgb(255 136 0 / 50%) or #ff880080.