Design tool

Color Converter

Enter a HEX, RGB or HSL color and get the other formats immediately.

Runs in your browser. No upload.

Supports HEX, RGB and HSL colors.

HEX
—
RGB
—
HSL
—

About this tool

Color Converter made simple.

Useful for CSS, brand palettes and quick design checks. The conversion and preview happen entirely in your browser.

Guide

Using Color Converter

The Color Converter takes one colour written as HEX, RGB or HSL and shows it in all three forms next to a small swatch. It is meant for CSS work and quick design checks. It reads three-digit and six-digit HEX codes, rgb() with values from 0 to 255, and hsl() with percentages. It does not handle transparency, colour names, or print colour spaces such as CMYK.

How to use it

  1. Type or paste a colour into the box, such as #4D6BFF, 4d6bff, rgb(77, 107, 255) or hsl(230, 100%, 65%). The box starts with #4D6BFF already in it.
  2. Press Convert color. The HEX, RGB and HSL lines fill in and the swatch shows the colour.
  3. Select the line you need and copy it by hand into your stylesheet or design file.
  4. If the three lines show a dash, the text was not understood. Read the message under the box and fix the format.

Worked examples

A six-digit HEX code

You enter
Color
#4D6BFF
You get
Hex
#4D6BFF
Rgb
rgb(77, 107, 255)
Hsl
hsl(230, 100%, 65%)

Each pair of HEX digits is one channel: 4D is 77, 6B is 107 and FF is 255. The HSL form is worked out from those three numbers and rounded to whole numbers.

Run through the tool’s own code.

An HSL colour

You enter
Color
hsl(120, 50%, 50%)
You get
Hex
#40BF40
Rgb
rgb(64, 191, 64)
Hsl
hsl(120, 50%, 50%)

A hue of 120 is green, and 50% saturation and lightness give a soft mid green. The red and blue channels come out at 64 and the green channel at 191.

Run through the tool’s own code.

Converting back loses a little

You enter
First
#123456
Second
hsl(210, 65%, 20%)
You get
First gives hsl
hsl(210, 65%, 20%)
Second gives hex
#123354

The HEX code #123456 is shown as hsl(210, 65%, 20%), with each number rounded to a whole number. Typing that HSL value back gives #123354, a slightly different colour, because the rounding threw away a little detail.

Run through the tool’s own code.

When it helps

  • Turn a brand HEX code from a style guide into the rgb() or hsl() form that your CSS uses.
  • Read an hsl() value from a stylesheet as HEX so you can paste it into a design program.
  • Find the HSL numbers for a colour before you make it lighter or darker by hand.
  • Check a short three-digit HEX code by seeing the full six-digit colour it stands for.

Limits to keep in mind

  • Accepted inputs are HEX with 3 or 6 digits, rgb(r, g, b) with commas and values from 0 to 255, and hsl(h, s%, l%) with commas. Colour names, percentages inside rgb(), and space-separated syntax such as rgb(77 107 255) are refused.
  • There is no alpha channel. An 8-digit code like #4D6BFF80 or rgba(77, 107, 255, 0.5) gives an error, even though CSS allows both.
  • HSL results are rounded to whole numbers, and decimals in rgb() are rounded to the nearest whole number, so a round trip can end one step away from where it began.
  • The tool does plain sRGB-style arithmetic for web colours. It does no colour management, no CMYK and no wide-gamut spaces.

Tips

  • Keep the original HEX or RGB value as your master copy and treat the rounded HSL as a handy working view.
  • Use the HSL lightness number to make a darker or lighter shade, then convert the new value back to HEX.
  • A colour that looks good as a swatch can still be hard to read as text, so check text contrast with a separate contrast checker.

Sources

Common questions

About Color Converter.

How do I convert HEX to RGB?

Type the HEX code and press Convert color. Each pair of digits is one channel in base 16, so #4D6BFF becomes rgb(77, 107, 255). The tool does the arithmetic and shows the RGB and HSL forms together.

Do I need to type the # sign?

No. The hash is optional, and capital or small letters both work. The tool writes the HEX result in capitals with a hash, so 4d6bff and #4D6BFF give the same lines.

Does it accept short codes like #f80?

Yes. A three-digit code repeats each digit, as the CSS colour standard describes, so #f80 is read as #FF8800 and shows as rgb(255, 136, 0). Codes with 4 or 8 digits, which carry transparency, are not accepted.

Why does my colour change a little when I convert back?

HSL is shown with whole numbers for hue, saturation and lightness. Rounding removes small differences, so turning that HSL back into HEX can land on a neighbouring colour. Keep the first HEX or RGB value as the exact one.

Why do I get an error for rgba or a colour name?

The tool reads only opaque colours in the three listed forms. A colour name such as red, or any value with an alpha number, is refused. Replace the name with its code, such as #FF0000.

Is my colour sent anywhere?

No. The page says the conversion and the preview happen entirely in your browser, so the colour you type is not uploaded.

Which color formats are supported?

The converter accepts HEX, RGB and HSL colors and displays the equivalent values in all three formats.