designwithfocus

Color codes & color models

What Is RGB? The Red, Green and Blue Color Model Explained

By Design With Focus Team 4 min read
Red, green and blue light circles overlapping into cyan, magenta, yellow and white

Short answer

RGB is a color model that builds colors by mixing red, green and blue light. Each channel usually runs from 0 to 255, so rgb(255, 0, 0) is pure red and rgb(255, 255, 255) is white. With 256 levels per channel, RGB can describe about 16.7 million colors. Screens, cameras and web code all use RGB.

Last verified against the sources listed below.

Key takeaways

  • RGB mixes red, green and blue light to make colors.
  • Each channel runs 0 to 255 in 8-bit color, giving 16,777,216 combinations.
  • All channels at 255 make white; all at 0 make black.
  • HEX codes are RGB values written in base 16, such as #FF0000.
  • Use RGB for screens and CMYK for print.

Every color on your screen right now is made from just three colors of light: red, green and blue. RGB is the system that describes how much of each one to use. It is the language of monitors, phones, cameras and web design.

Quick facts
Stands for Red, green, blue
Type Additive (mixes light)
Usual range 0 to 255 per channel
Colors in 8-bit RGB 16,777,216
Black rgb(0, 0, 0)
White rgb(255, 255, 255)

RGB mixes light, not paint

RGB is additive: it starts from black and adds light. With every channel at zero, a pixel gives off no light and looks black. Turning channels up adds light and makes the color brighter.

X-Rite explains that mixing red, green and blue light at different intensities can simulate a full range of colors. Paint and ink work the other way, subtracting light, which is why RGB and paint give different results for the same pair of colors.

Light mix Result
Red + green Yellow
Green + blue Cyan
Red + blue Magenta
Red + green + blue White

How RGB values work

Each channel gets a number from 0 (off) to 255 (full). Three numbers together describe one color.

  • rgb(255, 0, 0): red only, pure red.
  • rgb(0, 128, 0): half green, the CSS color green.
  • rgb(128, 128, 128): equal channels, a mid gray.
  • rgb(255, 165, 0): full red, some green, orange.

Equal values on all three channels always give a neutral gray, from black at 0 to white at 255. The MDN reference for rgb() shows how CSS writes these values, including the newer space-separated syntax.

Why there are 16.7 million colors

Standard RGB uses 8 bits per channel, which gives 256 levels each. 256 × 256 × 256 = 16,777,216 combinations.

That is called 24-bit color, since 8 bits times three channels is 24. Some displays and file formats use 10 or 12 bits per channel for smoother gradients and HDR video. Those allow far more shades than 8-bit RGB.

RGB and HEX are the same color

A HEX code is just RGB written in base 16. Each channel becomes two hexadecimal digits, and the three pairs join after a # sign.

RGB HEX
rgb(255, 0, 0) #FF0000
rgb(0, 128, 128) #008080
rgb(255, 87, 51) #FF5733

Our guide on converting RGB to HEX walks through the math step by step.

RGBA: adding transparency

RGBA adds a fourth value for opacity, called alpha. In CSS, alpha runs from 0 (fully transparent) to 1 (fully opaque).

For example, rgba(0, 0, 0, 0.5) is black at half opacity, which is handy for shadows and overlays. Modern CSS lets you write the same thing as rgb(0 0 0 / 50%), as defined in the W3C CSS Color Module.

sRGB: the standard RGB space

sRGB defines exactly which red, green and blue the numbers mean. Without a defined color space, rgb(255, 0, 0) could look different on every device.

Wikipedia’s sRGB article describes it as the standard color space for the web and most consumer displays. Newer screens can show wider spaces such as Display P3, which reach more saturated colors than sRGB.

RGB vs CMYK

Use RGB for screens and CMYK for print. They work in opposite ways and cover different ranges of color.

RGB CMYK
Used for Screens, web, video Commercial printing
How it works Adds light Subtracts light with ink
Starts from Black White paper
Best at Bright, saturated colors Matching printed output

Some very bright RGB colors cannot be printed, so they look duller in CMYK. When you prepare a print file, convert early and check the result. The RGB to CMYK Converter gives a starting value for any color.

Where you will meet RGB

RGB appears in design tools, code and camera settings. Figma, Photoshop and Canva all show RGB values in their color pickers. CSS accepts rgb() directly. Digital cameras record images as RGB data.

The free RGB to HEX Converter turns any RGB value into a HEX code you can paste into code or a design file.

Frequently asked questions

What does RGB stand for?

RGB stands for red, green and blue, the three colors of light that screens combine to make every other color. Each pixel on a display has tiny red, green and blue parts, and changing their brightness changes the color you see.

How many colors can RGB make?

In standard 8-bit color, each channel has 256 levels, from 0 to 255. Multiplying 256 by 256 by 256 gives 16,777,216 possible colors. Higher bit depths, such as 10-bit HDR, allow many more shades per channel.

What is the difference between RGB and HEX?

They describe the same color in different notation. RGB writes each channel as a decimal number, like rgb(255, 87, 51). HEX writes the same three numbers in base 16 and joins them, like #FF5733. Converting between them changes nothing about the color.

Should I use RGB or CMYK?

Use RGB for anything shown on a screen, such as websites, apps, social media and video. Use CMYK for files going to a commercial printer. Converting RGB to CMYK can dull some bright colors, because ink cannot reproduce every screen color.

What is sRGB?

sRGB is the standard RGB color space used by most screens, browsers and web images. It defines exactly which red, green and blue each value means, so the same numbers look as consistent as possible across devices. Unless stated otherwise, web colors are sRGB.

Sources