What Is RGB Color? Complete Beginner Guide
Learn what RGB color is, how red, green and blue channels mix on screens, and how to use rgb() values in your designs.
Every color you see on a phone, laptop or television starts with just three colors: red, green and blue. This system is called RGB, short for Red, Green, Blue. When you understand RGB, you understand how digital color works, and you can pick and adjust colors with more confidence in websites, apps and graphics.
RGB is the color model used by screens. It is different from paint or ink, where mixing colors makes them darker. On a screen, mixing light makes colors brighter. That simple difference explains why RGB behaves the way it does.
What Is RGB Color?
RGB is an additive color model. Additive means you start with darkness and add light to create color. A screen starts black when no light is shown. Add red light and you see red. Add green light and you see green. Add blue light and you see blue. Add all three at full strength and you see white.
Each tiny dot on a screen, called a pixel, contains red, green and blue sub-pixels. The screen controls how brightly each one glows. By changing those three brightness levels, it can show millions of colors. You do not see the separate sub-pixels from a normal distance. Your eyes blend them into one smooth color.
How the Three Channels Work: 0 to 255
In RGB, each channel has a value from 0 to 255. Zero means the light is off. The number 255 means the light is at full brightness. Any number in between gives a partial brightness. With 256 values for each channel, RGB can describe more than 16 million colors.
| Color | RGB Value | Meaning |
|---|---|---|
| Black | rgb(0, 0, 0) | All lights off |
| White | rgb(255, 255, 255) | All lights at full brightness |
| Pure red | rgb(255, 0, 0) | Only red is on |
| Pure green | rgb(0, 255, 0) | Only green is on |
| Pure blue | rgb(0, 0, 255) | Only blue is on |
| Yellow | rgb(255, 255, 0) | Red and green together |
| Grey | rgb(128, 128, 128) | All channels equal |
When all three channels have the same value, the result is a shade of grey. Low equal values give dark grey, high equal values give light grey. This is a useful check: if your grey looks blue or pink, one channel is higher than the others.
Mixing two channels at full strength gives secondary colors. Red and green make yellow. Red and blue make magenta. Green and blue make cyan.
How to Write RGB in CSS
In CSS, you write an RGB color with the rgb() function. List the red, green and blue values inside the brackets, separated by commas. The order always stays the same: red first, then green, then blue.
/* Pure blue text */
.heading {
color: rgb(0, 0, 255);
}
/* A soft blue background */
.card {
background-color: rgb(47, 123, 255);
}
/* Dark grey body text */
body {
color: rgb(51, 51, 51);
}
You can also add transparency with rgba(). The fourth value, called alpha, runs from 0 for fully transparent to 1 for fully solid. For example, rgba(0, 0, 0, 0.5) is black at half opacity. This is useful for overlays and subtle backgrounds, because the color underneath still shows through.
When to Use RGB Instead of HEX
RGB and HEX describe the same colors in different ways. HEX is a shorter code that packs the same three values into six characters. For example, rgb(47, 123, 255) is written in HEX as #2F7BFF. The color is identical. Only the notation is different.
Choose RGB when you want to read or adjust the channels directly. It is easier to see that rgb(255, 100, 100) is a light red than to work that out from a HEX code. RGB is also better when you need transparency, because rgba() adds opacity in one step.
Choose HEX when you want a short value to copy into code or a style guide. You can learn more in our guide to what a HEX color code is, and convert between the two formats with our free HEX to RGB converter.
Practical Tips for Using RGB
- Change one channel at a time. Start from a base color and adjust a single value. This shows how each channel affects the result and helps you find shades in the same color family.
- Use equal channels for clean greys. Bring the three values back to equal numbers to remove a blue, green or pink tint.
- Avoid pure black on pure white for large text areas. It can feel harsh on screens. A very dark grey, such as rgb(31, 31, 31), and an off-white background often feel more comfortable to read.
- Test colors at real sizes. A color that looks good as a small swatch may feel too bright as a full background. Check buttons, headings and backgrounds at the size people will see them.
- Check contrast before you publish. Light text needs a dark enough background, and dark text needs a light enough background. Good contrast keeps your design readable for everyone.
Explore colors hands-on with the free online color picker on Front Design Tool. Pick a color, read its RGB values, adjust the channels, and copy the result into your CSS. Once you can read RGB values at a glance, choosing colors stops being guesswork.