HEX, RGB, and HSL are three common ways to write digital colors. HEX is a compact web code, RGB describes red, green, and blue light values, and HSL describes hue, saturation, and lightness. They can describe the same color, but each format uses a different kind of language.

This beginner guide explains what each format means in plain terms. For a practical decision guide about which one to use in CSS or design systems, read HEX vs RGB vs HSL.

What does HEX mean?

HEX (short for hexadecimal) is the most common format for colors on the web. It looks like this:

HEX
#6C5CE7
A 6-digit code starting with #. Each pair of digits represents the Red, Green, and Blue value of the color (in that order).

HEX is compact and easy to copy. It is the default format most design tools show when you select a color. The # symbol simply tells the browser it is a HEX color.

What does RGB mean?

RGB stands for Red, Green, Blue. It describes a color by telling exactly how much red, green, and blue light to mix together.

RGB
rgb(108, 92, 231)
Three numbers from 0 to 255. The first is Red, second is Green, third is Blue. 0 means none of that color; 255 means full intensity.

RGB comes from the world of screens and light. If you have ever mixed paint, think of it differently: adding more of each color makes the result brighter, not darker. Pure white is rgb(255, 255, 255) - all lights at full. Pure black is rgb(0, 0, 0) - all lights off.

What does HSL mean?

HSL stands for Hue, Saturation, Lightness. This format was designed to match how humans naturally think about color.

HSL
hsl(247, 72%, 63%)
Three values: Hue (0-360 degrees on a color wheel), Saturation (0-100%, how vivid or gray the color is), Lightness (0-100%, how light or dark the color is).

HSL is the easiest format to adjust by hand. Want a lighter version of a color? Increase the last number. Want a more muted tone? Decrease the middle number. It maps directly to the words designers and artists use every day.

Why do digital tools use different color formats?

Can HEX, RGB, and HSL describe the same color?

Here is the same purple shown in all three formats:

The same color
#6C5CE7  ·  rgb(108, 92, 231)  ·  hsl(247, 72%, 63%)
All three describe exactly the same color, just written differently. Choose whichever format is most convenient for your workflow.

How do I convert between color codes?

PhotoColor provides free tools to convert between all three formats instantly. No math required - just enter a color value and get the equivalent in the other formats.

HEX to RGB
Convert HEX to RGB instantly
RGB to HEX
Convert RGB to HEX instantly

To test real colors while you convert formats, copy examples from Website Color Palettes or Blue Color Palettes. For more context, read HEX vs RGB vs HSL and Best Website Color Schemes.

FAQ

Is HEX different from RGB?

HEX and RGB can describe the same color. They are different ways to write the same red, green, and blue channel values.

When should I use HSL?

Use HSL when you want to adjust hue, saturation, or lightness by hand, especially for lighter and darker UI states.

Which color format is best for CSS?

All three work in CSS. HEX is compact, RGB is familiar for screen values, and HSL is convenient for adjustments.