Crashes, No Sound, or Screen Glitches?
Free tools Windows power users keep installed
One-click scans. No signup required.
Outbyte Driver Updater · freeRandom freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.
Find the Right Drivers →ThatPainter is reader-supported. When you buy through links on our site, we may earn an affiliate commission. Learn More
In CSS, rgb() sets a color with red, green, and blue components; it can also include alpha to control transparency. rgba() is an alias for rgb(), so the practical difference is syntax: modern CSS uses space-separated channels and an optional slash before alpha, while the older form uses commas.
To set transparency with modern rgb(), write a slash followed by an alpha value: rgb(255 0 0 / 0.5) is red at 50% opacity. If the color is fully opaque, omit alpha.
What RGB and RGBA mean
RGB stands for red, green, blue. CSS rgb() expresses a color in the sRGB color space. Each channel can be a number from 0 through 255 or a percentage from 0% through 100%.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Alpha controls transparency, not the red, green, or blue components. An alpha value of 0 is fully transparent; 1 or 100% is fully opaque. If alpha is omitted, the color is fully opaque. MDN describes rgba() as an alias for rgb().
#1 Best Overall
- Features numbered swatches
- 2 value finders -green and red
- Color guide and fabric preview window
| Notation | Example | Use |
|---|---|---|
| Modern, opaque | rgb(40 80 120) |
Recommended for new CSS |
| Modern, translucent | rgb(40 80 120 / 0.35) |
Use a slash before alpha |
| Legacy, opaque | rgb(40, 80, 120) |
Recognize in existing stylesheets |
| Legacy, translucent | rgba(40, 80, 120, 0.35) |
Recognize in existing stylesheets; rgba() is an alias |
Modern RGB syntax
Modern CSS separates the three channels with spaces. When you include alpha, put a slash before it:
rgb(255 0 0) is opaque red. rgb(255 0 0 / 0.5) is red at 50% opacity. You can also write the channels and alpha as percentages: rgb(100% 0% 0% / 50%).
For new examples, MDN recommends the modern syntax and the shorter rgb() name. Omit alpha when it is fully opaque.
Legacy comma-separated syntax
Older CSS commonly separates channels with commas. For example, rgb(255, 0, 0) is opaque red, while rgba(255, 0, 0, 0.5) is red at 50% opacity. This legacy syntax remains documented; it is useful to recognize when maintaining existing CSS.
Rank #2
- These are the words in Charlotte's web, high in the barn
- Her spiderweb tells of her feelings for a little pig named Wilbur, as well as the feelings of a little girl named Fern … who loves Wilbur, too
- Their love has been shared by millions of readers
Do not mix the two forms. Use either space-separated channels with a slash before alpha, or the complete comma-separated form.
Understanding alpha and transparency
Alpha affects how a color blends with what is behind it. It does not turn the color into one fixed, lighter opaque color: the visible result depends on the background.
| Alpha value | Meaning |
|---|---|
0 or 0% |
Fully transparent |
0.25 or 25% |
25% opaque |
0.5 or 50% |
50% opaque |
0.75 or 75% |
75% opaque |
1 or 100% |
Fully opaque |
For example, rgb(255 0 0 / 0.2) is 20% opaque and 80% transparent. Alpha can be useful for translucent backgrounds, borders, shadows, and overlays.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesUsing RGB colors in HTML
RGB is a CSS color value, not an HTML element or special HTML color attribute. Apply it in a style attribute, an embedded stylesheet, or an external CSS file.
Inline CSS
<p style="color: rgb(34 34 34);">Dark gray text</p>
Inline styles are convenient for small demonstrations, but repeated colors are harder to maintain this way.
Embedded or external CSS
In a stylesheet, declare the color on a selector. For example: .notice { color: rgb(20 40 80); background-color: rgb(80 160 240 / 0.2); }. Use a shared stylesheet when you want styles to be reusable.
RGB and hexadecimal colors
The same opaque red can be written as rgb(255 0 0) or #ff0000. CSS hexadecimal colors can also include alpha: the eight-digit form is #RRGGBBAA, with the alpha component last. For example, #ff000080 is approximately 50% alpha.
Recommended Free Tools
For more on hexadecimal syntax, see MDN’s hexadecimal color reference.
Rank #4
Transparency and accessible color choices
A translucent color looks different over different backgrounds. Check text and background colors in their actual rendered context, including when a background is an image or changes across a page.
- Test the complete text-and-background combination, not just the foreground color.
- Check hover and keyboard focus states separately.
- Do not use transparency to conceal low-contrast text.
- Keep focus indicators clearly visible.
MDN’s CSS style guidance recommends aiming for at least a 4.5:1 contrast ratio between text and its background. Alpha alone does not guarantee accessible contrast; the final composition matters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common mistakes
Using RGB as though it were an HTML element
RGB belongs in a CSS declaration, such as color: rgb(255 0 0);, not as an HTML tag.
Adding alpha without a separator
In modern syntax, use a slash before alpha: rgb(255 0 0 / 0.5). In legacy syntax, use the complete comma-separated form: rgba(255, 0, 0, 0.5).
Mixing modern and legacy syntax
Keep each color function consistent: use spaces and slash-alpha together, or commas throughout the legacy form.
Assuming alpha lightens a color
Alpha controls transparency. The resulting appearance depends on the color behind it.
FAQ
What is the difference between RGB and RGBA in CSS?
There is no separate color model: rgba() is an alias for rgb(). The name rgba() is commonly seen in legacy comma-separated syntax; modern syntax can include alpha in rgb().
Free tools Windows power users keep installed
One-click scans. No signup required.
How do I set transparency with rgb() in CSS?
Use a slash and an alpha value, such as rgb(255 0 0 / 0.5) for red at 50% opacity. Alpha can be a number from 0 to 1 or a percentage from 0% to 100%.
What happens if I leave out alpha?
The color is fully opaque. For new CSS, MDN recommends omitting alpha when it is 1.
Should I use commas or spaces in rgb()?
For new code, use space-separated channels and a slash before alpha when needed. Comma-separated syntax remains useful to recognize in existing code; do not mix the forms.
Is every newer CSS color feature supported everywhere?
Basic RGB is widely available, but newer parts of CSS color syntax can have different browser support. Check compatibility for the specific feature you plan to use rather than assuming all color features have the same support.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




