Color RGB

Deep dive into the RGB color model with interactive sliders

What Is the RGB Color Model?

RGB stands for Red, Green, and Blue — the three primary colors of light. Every color on your screen is produced by mixing these three channels at different intensities, each ranging from 0 (off) to 255 (full intensity).

RGB is an additive color model: adding all three channels at full intensity produces white, while all channels at zero produces black. This is the opposite of paint mixing, where combining all colors tends toward black (subtractive mixing).

#6C63FFrgb(108, 99, 255)
Red108
Green99
Blue255
HEX#6C63FF
RGB108, 99, 255
HSL243°, 100%, 69%

How RGB Mixing Works

Unlike paint, where mixing colors makes them darker, light works the opposite way. Combining colored lights adds energy, making the result brighter. Here are the primary light mixtures:

Yellow
Red + Green
rgb(255, 255, 0)
Magenta
Red + Blue
rgb(255, 0, 255)
Cyan
Green + Blue
rgb(0, 255, 255)
White
Red + Green + Blue
rgb(255, 255, 255)

Common RGB Colors

ColorSwatchRGBHEX
Red
25500#FF0000
Green
01280#008000
Blue
00255#0000FF
Yellow
2552550#FFFF00
Cyan
0255255#00FFFF
Magenta
2550255#FF00FF
White
255255255#FFFFFF
Black
000#000000
Orange
2551650#FFA500
Purple
1280128#800080
Pink
255192203#FFC0CB
Gray
128128128#808080

Try It — CSS rgb() Syntax

Live Editor
R66
G133
B244
.element { background-color: rgb(66, 133, 244); color: #ffffff; }
rgb(66, 133, 244)

The Math Behind RGB

Each channel uses 8 bits, giving 256 possible values (0–255). With three channels, the total number of representable colors is 256 × 256 × 256 = 16,777,216 — about 16.7 million unique colors.

In CSS, you can also use percentage notation: rgb(100%, 40%, 0%) is equivalent to rgb(255, 102, 0). Modern CSS also supports the new space-separated syntax:rgb(255 102 0).

💡
Pro tip: When all three RGB values are equal, you get a shade of gray.rgb(0,0,0) is black, rgb(128,128,128) is medium gray, and rgb(255,255,255) is white.