RGB Color Validator
Validate an rgb()/rgba() string or individual R, G, B, A fields, with a specific explanation of which channel is out of range if invalid.
How to Use the RGB Color Validator
Choose between entering a full rgb(r, g, b) or rgba(r, g, b, a) string, or entering individual R, G, B, and (optionally) A number fields directly. The tool validates each channel: Red, Green, and Blue must be whole numbers from 0 to 255, and alpha (if present) must be a decimal between 0 and 1. If anything is invalid, it explains specifically which channel is out of range.
Example
rgb(59, 130, 246) is valid. rgba(59, 130, 246, 0.9) is valid. rgb(300, 0, 0) is invalid — Red (300) is above the maximum of 255. rgba(0, 0, 0, 1.5) is invalid — Alpha (1.5) is above the maximum of 1.
Common Use Cases
- Checking whether a color value from user input or an external file is valid before using it.
- Debugging a CSS rule that isn't applying due to an out-of-range channel value.
- Validating individual R, G, B, A values before combining them programmatically.
FAQs
- Can R, G, or B be decimal numbers? No — R, G, and B must be whole integers between 0 and 255. A value like 128.5 is invalid, even though it falls within the numeric range, because RGB channels are always whole numbers.
- What range is alpha allowed to be in? Alpha is a decimal (not a percentage) between 0 (fully transparent) and 1 (fully opaque), inclusive. Values like 0.5 or 1 are valid; a value like 50 or 1.2 is not.
- Is the alpha channel required? No — leaving the alpha field blank (or using a plain
rgb()string) validates just the R, G, and B channels, since alpha is optional.
