RGB to HSL Converter

Type a color, pick one, or paste a code. Every format updates instantly.

Shades

Contrast (WCAG)

Convert RGB to HSL

Divide each channel by 255, find the largest and smallest values, and derive hue, saturation and lightness from them. For rgb(255, 107, 53) the result is hsl(16, 100%, 60%).

Use HSL when you want to build a palette: keep the hue, then vary saturation and lightness.

How to use this color converter

Enter a color in any common notation and the tool converts it to all the others. It accepts #3b82f6, 3b82f6, short HEX like #38f, rgb(59,130,246), hsl(217,91%,60%), hsv(217,76%,96%), cmyk(76,47,0,4) and basic color names such as coral. Use the picker for a visual choice, then press a copy button to put a value on your clipboard.

The address bar updates as you work (for example ?c=3b82f6), so you can bookmark a color or send the link to a teammate. Nothing is uploaded: all math runs in your browser.

Color formats explained

FormatRangeTypical use
HEX#000000 to #FFFFFFCSS, design tools, brand guides
RGB0 to 255 per channelScreens, CSS, canvas, image code
HSLH 0-360, S and L 0-100%CSS themes, easy lighter/darker variants
HSVH 0-360, S and V 0-100%Color pickers, graphics software
CMYK0 to 100% per inkPrint preparation (approximate)

Conversion formulas

HEX to RGB

Split the six digits into three pairs and read each pair as a base-16 number. For #3B82F6: 3B = 59, 82 = 130, F6 = 246.

RGB to HSL

Divide R, G, B by 255. Let max and min be the largest and smallest value, and d = max - min. Lightness L = (max + min) / 2. Saturation S = d / (1 - |2L - 1|), or 0 when d is 0. Hue depends on which channel is largest and is scaled to 0-360 degrees.

RGB to CMYK

K = 1 - max(R, G, B) using 0-1 values. Then C = (1 - R - K) / (1 - K), M = (1 - G - K) / (1 - K), Y = (1 - B - K) / (1 - K). This is the simple screen formula; real print results depend on the ink profile.

Contrast ratio

Relative luminance L = 0.2126R + 0.7152G + 0.0722B after linearizing each channel. Ratio = (L1 + 0.05) / (L2 + 0.05), with L1 the lighter color. WCAG AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1.

Basic color reference

NameHEXRGBHSL
Red#FF0000255, 0, 00, 100%, 50%
Lime#00FF000, 255, 0120, 100%, 50%
Blue#0000FF0, 0, 255240, 100%, 50%
Yellow#FFFF00255, 255, 060, 100%, 50%
Cyan#00FFFF0, 255, 255180, 100%, 50%
Magenta#FF00FF255, 0, 255300, 100%, 50%
Orange#FFA500255, 165, 039, 100%, 50%
Purple#800080128, 0, 128300, 100%, 25%
Navy#0000800, 0, 128240, 100%, 25%
Teal#0080800, 128, 128180, 100%, 25%
Maroon#800000128, 0, 00, 100%, 25%
Olive#808000128, 128, 060, 100%, 25%
Gray#808080128, 128, 1280, 0%, 50%
Silver#C0C0C0192, 192, 1920, 0%, 75%
Black#0000000, 0, 00, 0%, 0%
White#FFFFFF255, 255, 2550, 0%, 100%

Related color tools

FAQ

How do I convert HEX to RGB?

Paste the HEX code into the box above. The RGB row shows the three channel values from 0 to 255.

What is the difference between HSL and HSV?

Both describe hue and saturation. HSL uses lightness, where 50% is the pure color and 100% is white. HSV uses value, where 100% is the brightest form of the color. HSL is common in CSS; HSV is common in picker widgets.

Is the CMYK value exact for printing?

No. It is a mathematical conversion from RGB. Printers use ink profiles, so always proof final colors with your print provider.

What contrast ratio do I need for accessible text?

WCAG AA requires 4.5:1 for body text and 3:1 for large text (about 24px, or 19px bold). AAA requires 7:1 for body text.

Is my data sent anywhere?

No. The page has no backend and no tracking scripts. All conversions run locally in your browser.

Copied