๐ŸŽจ

Color Converter

Convert colors between HEX, RGB, and HSL with a live preview swatch.

rgb(99, 102, 241)
hsl(239, 84%, 67%)

๐ŸŽจHEX โ†” RGB โ†” HSL, with a live swatch

Paste a colour in any format โ€” #4f46e5, rgb(79, 70, 229), or hsl(243, 75%, 59%) โ€” and get the other two instantly, with a live preview swatch and a native picker. The three formats describe the same colour three ways; converting between them is daily work for anyone touching CSS.

๐ŸงฎThree languages for one colour

HEX #RRGGBB = RGB(0โ€“255 ร—3) ยท HSL = hue 0โ€“360ยฐ, saturation %, lightness %

HEX and RGB are the same numbers in different clothing โ€” two hex digits per channel. HSL is the human-friendly one: hue picks the colour wheel angle, saturation its intensity, lightness its brightness โ€” which makes "same colour, slightly darker" a one-number tweak instead of guesswork.

Indigo: #4f46e5 = rgb(79, 70, 229) = hsl(243, 75%, 59%). Want a darker shade for hover? Drop lightness to 45% โ€” no channel algebra needed.

๐Ÿ’กColour tips for the web

  • Design in HSL, ship in HEX: adjust lightness/saturation intuitively, then paste the hex.
  • Hover/active states: same hue and saturation, lightness ยฑ10% โ€” instantly cohesive.
  • Check text contrast (4.5:1 for body text) โ€” a pretty pair can be an unreadable pair.
  • #4f46e5 and #4F46E5 are identical; case never matters in hex.

๐Ÿ’ก Frequently Asked Questions

How do I convert HEX to RGB?+

Split the hex into pairs and read each as a number 0โ€“255: #4f46e5 โ†’ 4f=79, 46=70, e5=229 โ†’ rgb(79, 70, 229). Paste any hex here and the conversion (plus HSL) is instant.

What is HSL and why use it?+

Hue (0โ€“360ยฐ on the colour wheel), Saturation (0โ€“100%), Lightness (0โ€“100%). It matches how people think about colour โ€” 'a bit darker' or 'less vivid' is a single-number change, which is why designers prefer editing in HSL.

What are the 3-digit hex codes like #fff?+

Shorthand where each digit doubles: #fff = #ffffff (white), #4ae = #44aaee. Handy for quick grays and simple colours; expand to 6 digits when precision matters.

How do I make a colour darker for a hover state?+

Convert to HSL and reduce lightness by about 10 percentage points, keeping hue and saturation. That preserves the colour's character โ€” unlike darkening RGB channels, which can shift the hue.

Does this support transparency (alpha)?+

The converter works with opaque colours (the formats above). For transparency, append alpha in CSS: #4f46e5cc (8-digit hex) or rgba(79, 70, 229, 0.8).

๐Ÿ”— Related Tools