Color Converter

Convert colors between HEX, RGB and HSL online. Paste any format and get all three, with a live preview. Runs entirely in your browser.

All processing happens in your browser. Nothing is uploaded.

  • HEX#2f6df6
  • RGBrgb(47, 109, 246)
  • HSLhsl(221, 92%, 57%)

HSL is stored as whole numbers, so converting back to RGB can differ by up to about 1%.

How to use

  1. Paste a color in any supported format.
  2. HEX, RGB and HSL all update immediately, with a preview swatch above them.
  3. Click Copy next to whichever format you need.

HEX, RGB and HSL describe the same colors differently

HEX and RGB are the same thing in different clothes. Both give the intensity of red, green and blue from 0 to 255; hex writes each as two hexadecimal digits, RGB writes them as decimal numbers. #2f6df6 and rgb(47, 109, 246) are byte-for-byte identical, which is why converting between them is exact and reversible.

HSL is a genuinely different model. It describes a color as a position on the color wheel (hue, 0–360°), how vivid it is (saturation, 0–100%), and how light it is (lightness, 0–100%). This matters in practice because it matches how people actually think about color. “The same blue, but lighter” is a one-number change in HSL and an opaque puzzle in hex.

That is also why HSL is the right tool for building a palette. Fix the hue at 220, step the lightness from 95% down to 20%, and you get a coherent set of tints and shades of one blue. Trying to produce that by hand-editing #2f6df6 is guesswork.

The trade-off is precision. Because HSL is written with integers, the conversion back to RGB rounds, and you can end up about 1% away from where you started. For display that difference is invisible; if you need an exact value to survive a round trip, keep it in hex.

Frequently asked questions

Which formats can I paste in?

Three-digit hex (#fff), six-digit hex (#2f6df6), eight-digit hex with alpha (#2f6df680), rgb(), rgba(), hsl() and hsla(). The leading # is optional and spacing does not matter.

Why does the HSL value not convert back to exactly the same RGB?

HSL is conventionally written with whole numbers, as in hsl(221, 92%, 57%). Rounding three values to integers loses a little precision, so converting back can land up to about 1% away. HEX and RGB describe the same thing byte for byte and do round-trip exactly.

What does the fourth value in rgba() mean?

Alpha — opacity from 0 (fully transparent) to 1 (fully opaque). In eight-digit hex the last two digits carry the same information as 00 to ff, so #ff000080 is red at roughly 50% opacity.

When should I use HSL instead of HEX?

When you want to derive colors rather than pick them. Because HSL separates hue from saturation and lightness, you can build a consistent palette by holding the hue and stepping the lightness — something that is essentially impossible to do by editing hex digits.

Is my data uploaded?

No. The conversion is a few lines of arithmetic running in your browser.