Color Guide

What is RGB?

RGB stands for Red, Green, and Blue. It is a color model that creates colors by combining red, green, and blue light. Each channel controls the intensity of one component.

In the common 8-bit RGB representation used for web colors, each channel is usually expressed as a value from 0 to 255. Read rgb(51, 102, 204) from left to right: Red = 51, Green = 102, Blue = 204.

51Red
102Green
204Blue

How Does RGB Work?

Think of the three channels as controls for red, green, and blue light. In common 8-bit RGB, 0 means no contribution from a channel and 255 means maximum intensity. Values between them represent intermediate intensities; changing one channel changes the combined color.

Using one channel at full intensity gives rgb(255, 0, 0) (Red), rgb(0, 255, 0) (Lime), or rgb(0, 0, 255) (Blue). In our example above, blue has the highest channel value, producing a blue color.

RGB Is an Additive Color Model

RGB works by adding light, starting from black. At full intensity, red and green light combine to make yellow; green and blue make cyan; blue and red make magenta. All three together produce white. With no red, green, or blue light, the result is black.

Full-intensity light: Red + Green = Yellow; Green + Blue = Cyan; Blue + Red = Magenta; Red + Green + Blue = White.

This differs from mixing paint or ink. RGB mixes light, while printing commonly uses subtractive color systems such as CMYK, where inks absorb some of the light reflected from paper.

Understanding RGB Values

These examples show how turning channels on or off creates familiar colors. Both the name and RGB value are listed alongside each swatch.

Blackrgb(0, 0, 0)
Whitergb(255, 255, 255)
Redrgb(255, 0, 0)
Limergb(0, 255, 0)
Bluergb(0, 0, 255)
Yellowrgb(255, 255, 0)
Cyanrgb(0, 255, 255)
Magentargb(255, 0, 255)

Neutral gray

Equal red, green, and blue values create a neutral gray. Lower values give darker grays; higher values give lighter grays, reaching black and white at the endpoints.

Dark grayrgb(51, 51, 51)
Mid grayrgb(128, 128, 128)
Light grayrgb(204, 204, 204)

Why 0–255?

In common 8-bit RGB, each channel uses 8 bits. Since 28 = 256, there are 256 possible values, numbered 0 through 255. Three channels give 256 × 256 × 256 = 16,777,216 possible RGB combinations.

24-bit color

8 bits for red + 8 bits for green + 8 bits for blue = 24 bits. This representation is called 24-bit color, without counting any additional alpha channel. RGB can also use other bit depths; 8 bits per channel is a common representation, not a requirement of the model.

RGB and HEX

On the web, #3366CC and rgb(51, 102, 204) express the same sRGB color. HEX writes each RGB channel in hexadecimal notation; this RGB notation writes the same values as decimal numbers.

HEX

#3366CC

33 → decimal 51
66 → decimal 102
CC → decimal 204

RGB

rgb(51, 102, 204)

Red = 51
Green = 102
Blue = 204

Learn more about HEX color codes →

Try the Color Converter → to compare HEX, RGB, and HSL notation for your own colors.

Using RGB in CSS

Use rgb() wherever CSS accepts a color, including text, backgrounds, and borders:

.example {
    color: rgb(51, 102, 204);
    background-color: rgb(245, 247, 250);
    border-color: rgb(217, 226, 242);
}

You will see both comma syntax, rgb(51, 102, 204), and modern space-separated syntax, rgb(51 102 204). These examples specify the same color.

RGB transparency

An alpha value controls transparency: 0% (or 0) is fully transparent, and 100% (or 1) is fully opaque. Modern CSS lets you include alpha directly in rgb(), after a slash:

.overlay {
    background-color: rgb(51 102 204 / 50%);
}

The equivalent comma form, rgba(51, 102, 204, 0.5), is still common in existing code and tutorials. rgba() is an alias of rgb(); transparency does not require a separate function. At 50% opacity, the background contributes to the visible result.

Where Is RGB Used?

RGB is especially useful for screens because displays produce colors from red, green, and blue light. Websites and apps use RGB colors for text, buttons, backgrounds, and other interface elements.

Digital designers also work with RGB in graphics, digital images, and UI design tools. These colors are viewed on monitors, phones, and other displays. A design intended for print may need conversion to the color system used by the printer.

RGB and Color Spaces

An RGB triplet describes channel values. The exact color those values represent also depends on the color space. For common web colors, sRGB is the standard reference: CSS rgb() and HEX notation both specify sRGB colors.

When moving colors between design tools, use the same color space to interpret the numbers consistently. Screen settings and viewing conditions can still affect how a color looks.

RGB and Accessibility

A value such as rgb(51, 102, 204) identifies a color within sRGB, but it cannot establish whether text will be readable. Contrast depends on the foreground and background together, and text size also matters.

Check the contrast of the actual color pair used in your interface. For transparent text or backgrounds, account for the colors underneath. Provide text labels or other cues as well as color so that everyone can understand the information.

Frequently Asked Questions

What does RGB stand for?

Red, Green, and Blue: the three light components combined by the RGB color model.

What do RGB values mean?

Each value indicates the intensity of the red, green, or blue channel, in that order, in common RGB notation.

Why do RGB values go from 0 to 255?

Common 8-bit RGB provides 256 possible values per channel, from 0 through 255.

Is RGB the same as HEX?

They can express the same sRGB color using different notation. For example, #3366CC = rgb(51, 102, 204).

What color is rgb(0, 0, 0)?

Black. All three channels contribute no light.

What color is rgb(255, 255, 255)?

White. All three channels are at full intensity in common 8-bit RGB.

Can RGB include transparency?

Yes. Modern CSS rgb() accepts alpha, as in rgb(51 102 204 / 50%).

Is RGB used for printing?

RGB is primarily used for digital displays. Printing commonly uses other color models such as CMYK.