EN

Color Code Converter (HEX, RGB, HSL)

Type a color in any field: HEX, RGB or HSL. The other formats update as you type, and every value is ready to paste into CSS.

#6D46D3
HEX#6D46D3
RGBrgb(109, 70, 211)
HSLhsl(256.6, 61.6%, 55.1%)
HSVhsv(256.6, 66.8%, 82.7%)
OKLCHoklch(0.519 0.205 290.1)

How to use it

  1. Type or paste a color into the HEX, RGB or HSL field, or use the color picker.
  2. The other fields update instantly; invalid input shows a short message instead of a wrong color.
  3. Copy any format with its copy button.

The color formats

  • HEX (#6D46D3): red, green and blue as two base-16 digits each. Three-digit HEX doubles each digit (#F60 = #FF6600).
  • RGB (rgb(109, 70, 211)): the same three channels as numbers from 0 to 255.
  • HSL (hsl(256.6, 61.6%, 55.1%)): hue angle on the color wheel, saturation and lightness. Handy for making a color lighter or more muted.
  • OKLCH (oklch(0.519 0.205 290.1)): lightness, chroma and hue in a perceptual color space supported by modern CSS; equal lightness values look equally light.

Rounding rules

RGB values are whole numbers. HSL and HSV keep one decimal, which is enough for every HEX code to convert to HSL and back without changing. OKLCH keeps three decimals for lightness and chroma.

Single-direction pages with the formula: HEX to RGB, RGB to HEX, HEX to HSL, HSL to HEX, HEX to RGBA, RGBA to HEX.

Frequently asked questions

Is HEX the same color as RGB?

Yes. A 6-digit HEX code is the same three RGB numbers written in base 16: two digits each for red, green and blue. Converting between them never changes the color.

Why can HSL values look slightly different on other sites?

Sites round differently. SwatchNest keeps one decimal for HSL, so converting back gives exactly the same HEX for every one of the 16,777,216 sRGB colors. Tools that round HSL to whole numbers can shift a color by one step.

Does it support transparency?

Use the HEX to RGBA and RGBA to HEX converters for alpha. The main converter works with solid colors.

Related tools