Color Converter

Convert a three- or six-digit HEX color to RGB and HSL.

Convert HEX into RGB and HSL

Color Converter accepts an opaque HEX value and displays its CSS HEX, RGB and HSL equivalents. This version converts from HEX; its field does not parse RGB/HSL functions, transparency or named colors.

Enter the source color

  1. Type three or six hexadecimal digits, optionally prefixed with #.
  2. Read the updated swatch and result.
  3. Select and copy the representation accepted by your destination.

Example: shorthand HEX

#369 expands to #336699. Output includes rgb(51, 102, 153) and hsl(210, 50%, 40%). Shorthand repeats each digit; it does not append zeroes.

Why is HSL rounded?

The conversion computes HSL from RGB channels, then rounds hue, saturation and lightness to whole numbers for display. HEX and RGB retain the original integer channel values. Keep one of those if exact repeated round trips matter; repeatedly converting rounded HSL can lose precision.

Why is a CSS color rejected?

Enter #RGB or #RRGGBB using digits 0–9 and letters a–f. A fourth/eighth alpha digit, a name such as rebeccapurple, or rgb(51 102 153) is outside the accepted syntax.

Calculations are local. Color Picker adds native visual selection; Gradient Generator combines two supported colors into CSS.