Color converter — HEX, RGB, HSL

Pick a color or type any value to instantly convert between HEX, RGB and HSL. Copy ready-to-use CSS with one click.

#4F8EF7
HEX
#4f8ef7
RGB
rgb(79, 142, 247)
HSL
hsl(218, 91%, 64%)
R
G
B
H °
S %
L %

HEX, RGB and HSL explained

HEX (e.g. #4f8ef7) is the six-digit hexadecimal notation used most often in web design and CSS. RGB describes a color as red, green and blue channels from 0–255 and is handy when mixing colors programmatically. HSL (hue, saturation, lightness) is the most intuitive for humans — nudge the lightness to create tints and shades of the same hue. All three describe the same color; this tool keeps them in sync as you edit any one of them.

Which format to reach for

FormatBest forSupports alpha
HEXDesign handoff, brand guidelines, anything copied between toolsYes, as 8 digits (#RRGGBBAA)
RGBProgrammatic mixing, canvas and image workYes, via rgb() with a slash
HSLBuilding tints, shades and themes by adjusting one numberYes, via hsl() with a slash
OKLCHPerceptually even palettes and accessible contrast stepsYes

Why HSL is easier to design with

HEX and RGB describe how a screen produces a colour; HSL describes how a person perceives one. That difference matters the moment you need a set of related colours rather than a single value.

To build a palette in HSL, hold the hue fixed and vary lightness — 90 percent for a pale background, 50 percent for a solid fill, 25 percent for text. Doing the same in HEX means recalculating three channels and hoping the result stays on the same hue. Complementary colours are equally direct: add 180 to the hue. Split complements are 150 and 210, and a triad is 120 apart.

Contrast and accessibility

Colour choices carry an accessibility obligation. WCAG 2.1 sets minimum contrast ratios between text and its background, and these are the levels most commonly required by policy and procurement.
ContentAA minimumAAA minimum
Body text under 18pt4.5:17:1
Large text, 18pt or 14pt bold3:14.5:1
Icons and UI component borders3:1
Decorative elementsNo requirement
A common trap is that HSL lightness is not perceived brightness. Pure yellow and pure blue can both sit at 50 percent lightness while looking dramatically different in weight, so two colours with matching lightness values can have completely different contrast against white. Always measure the ratio rather than trusting the number.

Colour on screens and in print

Everything on this page is RGB, an additive model where light is added to black. Print uses CMYK, a subtractive model where ink is removed from white. The two gamuts do not overlap fully, and RGB is the larger of them for vivid colours.

The practical result is that saturated screen colours — bright cyan, intense orange, vivid green — have no CMYK equivalent and will print noticeably duller. This is not a conversion error; those colours cannot be made with ink. For anything going to press, work from a CMYK or Pantone reference rather than converting a HEX value at the end.

Frequently asked questions

How do I convert HEX to RGB?

Type or paste your HEX code (with or without the #) into the HEX field. The RGB and HSL values update instantly, and you can copy any format with one click.

Does it support 3-digit shorthand HEX?

Yes. Short codes like #f80 are automatically expanded to their full 6-digit form (#ff8800) before conversion.

Can I use these values directly in CSS?

Absolutely. Copy the HEX, rgb() or hsl() string and paste it straight into your stylesheet — they are all valid CSS color values.

What does the # mean in a HEX colour?

It is only a marker indicating the digits that follow are hexadecimal. The six digits are three pairs giving the red, green and blue channels, each from 00 to FF (0 to 255).

How do I make a colour lighter or darker?

Convert to HSL and adjust the lightness value, leaving hue and saturation alone. That keeps the colour recognisably the same while changing only its brightness — much harder to do reliably in HEX.

What is the difference between HSL and HSV?

Both use hue and saturation, but HSL's third value is lightness where 100% is white, while HSV uses value where 100% is the most vivid form of the colour. HSL is used in CSS; HSV appears in many design applications.

Can I convert HEX to CMYK for printing?

A conversion exists, but it is approximate. RGB covers a wider gamut than CMYK ink, so vivid screen colours print duller. For print work, start from a CMYK or Pantone reference rather than converting at the end.

How do I check if my colours are accessible?

Measure the contrast ratio between text and background. WCAG AA requires 4.5:1 for body text and 3:1 for large text. Do not rely on HSL lightness as a proxy — perceived brightness varies a lot between hues.

What is OKLCH and should I use it?

A newer CSS colour space designed so that equal numeric steps look like equal visual steps, which HSL does not manage. It is excellent for generating consistent palettes and is supported in all current browsers.

Related free tools

QR code generatorImage compressorPassword generatorCase converter