Developer & data

HEX, RGB & HSL converter

Convert common web color formats with a color preview.

Runs in your browser · No file or text uploads
Preparing your tool…
ABOUT THIS TOOL

What HEX, RGB & HSL converter helps you do

Translate color codes between a design specification and the format required by your CSS.

How to use it

  1. Enter a HEX, rgb(...) or hsl(...) value.
  2. Run the conversion.
  3. Check the three codes and preview.

Input and output example

INPUT
#336699
OUTPUT
rgb(51, 102, 153) · hsl(210, 50%, 40%)

Supported formats and limits

  • Supports 3- or 6-digit HEX and comma-separated RGB or HSL.
  • Alpha channels, named colors, Display-P3 and OKLCH are unsupported.

How the result is calculated

Uses sRGB. RGB components are integers from 0 to 255; HSL saturation and lightness range from 0% to 100%. Hue wraps every 360 degrees. HSL output rounds to two decimals and HSL to RGB rounds to the nearest 8-bit integer.

Frequently asked questions

Why can a round trip change a component by one?

Displayed HSL rounding and 8-bit RGB quantization can produce a small difference.

Will the preview look identical on every screen?

Not necessarily. Display gamut, brightness and calibration can change the appearance of the same code.