Open any CSS file or design tool and you will encounter colors written in at least three different notations: #2563eb, rgb(37, 99, 235), hsl(220, 83%, 53%). They all describe the exact same blue. So why do three formats exist, and when should you reach for each one?

Why there are multiple color formats

Each format was designed for a different context and a different way of thinking about color. HEX was adopted early in web history because it maps directly to how computers store color in memory — compact, machine-friendly, easy to paste into HTML attributes. RGB reflects how screens actually work: mixing red, green and blue light to produce color. HSL was introduced later to give designers a more human-readable way to describe color — one where you can intuit what a value means without running mental arithmetic.

None of them is universally better. The right choice depends on what you are doing and who needs to read the code.

HEX explained

A HEX color is a six-character string prefixed with #, like #ff6b35. Each pair of characters represents one color channel — red, green and blue — expressed in base-16 (hexadecimal) notation. That means each channel runs from 00 (decimal 0) to ff (decimal 255).

So #ff6b35 breaks down as: red = ff (255), green = 6b (107), blue = 35 (53). The format can also be shortened to three characters when both digits in each pair are identical — #fff is the same as #ffffff.

HEX is the most common format you will see in CSS, design files and brand guidelines. It is compact and universally supported, but not easy to adjust by eye — changing a shade means doing hex arithmetic or reaching for a tool.

RGB explained

RGB stands for Red, Green, Blue — the three channels of additive color mixing used by every screen. In CSS, it is written as rgb(37, 99, 235), with each value ranging from 0 to 255. A value of 0 means none of that channel; 255 means full intensity.

Additive mixing means that combining all three channels at full intensity (rgb(255, 255, 255)) produces white, while zeroing all three (rgb(0, 0, 0)) produces black. This is the opposite of how paint or ink works, which is subtractive.

RGB is useful when you need to manipulate individual channels programmatically — for example, adjusting brightness by scaling all three values, or blending two colors by averaging their channels. It is also the native format for canvas drawing APIs and many image processing workflows.

HSL explained

HSL stands for Hue, Saturation, Lightness. Instead of describing a color by its channel intensities, it describes it by its perceptual properties:

HSL is written in CSS as hsl(220, 83%, 53%). The major advantage is legibility: to make a color lighter, you raise the lightness value. To create a muted version, you lower saturation. To find the complementary color, you add 180 to the hue. None of these operations require a calculator or a color picker — you can reason about them directly in code.

Designer tip: HSL is ideal for building color systems and design tokens. Define your brand hue once, then generate tints and shades by varying only the lightness value. The result is a consistent, harmonious palette with minimal effort.

When to use which format

There is no strict rule, but there are clear preferences that experienced designers and developers tend to follow:

Format Example Best for
HEX #2563eb Brand colors, design specs, copying from design tools, static values in CSS
RGB rgb(37, 99, 235) Canvas APIs, programmatic color manipulation, alpha blending with rgba()
HSL hsl(220, 83%, 53%) Design systems, theming, generating tints/shades, readable CSS variables

Quick conversion reference

Converting between the three formats by hand is rarely necessary — that is what tools are for. But understanding the relationships helps you reason about colors more confidently:

All three formats can represent exactly the same set of colors. No information is lost when converting between them — they are just different languages for the same thing.

Practical tips for designers and developers

Convert colors instantly

Paste any HEX, RGB or HSL value and get all three formats in one click. Explore harmonies too.

Open Color Picker