AyeCalc
All tools
CSS color

HEX, RGB & HSL Color Converter

Enter a HEX, RGB, or HSL color and get equivalent CSS notation. Use comma-separated or modern space-separated RGB and HSL values, with optional alpha transparency.

Alpha supportLive color previewThree CSS formats
sRGB formats

Convert a CSS color

Alpha supported

hex#67E5B4
rgbrgb(103 229 180)
hslhsl(156.7 70.8% 65.1%)
#67E5B4
Core formulaRGB channels → hue, saturation, and lightness

HEX stores RGB channel bytes; HSL describes the same sRGB color by hue, saturation, and lightness.

01
Method

How the color converter works

Parse the supplied HEX, RGB, or HSL syntax into sRGB channels, then calculate the equivalent formats. RGB channels accept 0–255 or percentages; HSL accepts a hue angle and percentage saturation and lightness. Channel values outside their supported ranges are rejected, and exported RGB channels are rounded to bytes.

FormulaRGB channels → hue, saturation, and lightness

HEX stores RGB channel bytes; HSL describes the same sRGB color by hue, saturation, and lightness.

02
Worked example

Convert #67e5b4 to RGB and HSL

The hexadecimal channels are 103 red, 229 green, and 180 blue. The equivalent CSS values are rgb(103 229 180) and approximately hsl(157 71% 65%).

03
Implementation

Copyable code examples

Use these examples as a starting point, then match the values and assumptions to the rendered project.

CSS HEX
.button { background: #67e5b4; }
CSS RGB
.button { background: rgb(103 229 180); }
CSS HSL
.button { background: hsl(157 71% 65%); }
04
Practical guidance

Using the result accurately

Use the notation that best supports the workflow. HEX is compact, RGB exposes channels and alpha clearly, and HSL can be convenient for systematic lightness or saturation adjustments.

Important limitation

The converter works in the sRGB color space. Wide-gamut color spaces such as display-p3 and perceptual models such as OKLCH require different conversions.

References: W3C CSS Color Module Level 4.

Common questions

Color Converter FAQ

Answers about the method, assumptions, and practical use.

Does HEX support transparency?

Yes. Four-digit #RGBA and eight-digit #RRGGBBAA notation include an alpha channel.

Does converting between HEX, RGB, and HSL change the color?

They can represent the same sRGB color. Rounding HSL values may produce a tiny difference if converted repeatedly.

What range does an RGB channel use?

Traditional CSS RGB channels use 0 through 255, while modern CSS also supports percentage and other color syntaxes.

What does HSL lightness mean?

Zero percent is black, 100 percent is white, and 50 percent is the midpoint for the selected hue and saturation.