RGB Color Validator
Check whether text is a valid RGB color as you type it, right in your browser, without sending it anywhere.
Input
Output
No value
Guide
What is an RGB color?
Screens mix red, green and blue light to make every color, and an RGB color gives the amount of each. In CSS it's written with each channel from 0 to 255, as in rgb(255, 128, 0) for a warm orange, or with percentages, as in rgb(100%, 50%, 0%). The rgba() form adds a fourth value, the alpha, for the opacity, from 0 (fully transparent) to 1 (solid): rgba(255, 128, 0, 0.5) is the same orange at half opacity.
You meet RGB colors in stylesheets, design tools, website themes and chart settings, and you check one when a page ignores a color you set, or when you build a theme editor or a form that accepts colors.
Tool description
Type or paste a color into the RGB color field, and the result shows as you type: "RGB color is valid" or "RGB color is not valid". Spaces and line breaks around the color are ignored.
Allow percentages starts on, so channels written as percentages pass as well. Turn it off to accept only numbers from 0 to 255.
Allow spaces also starts on and accepts spaces inside the brackets, as in rgb(255, 128, 0). Turn it off, and only the form without any spaces passes: rgb(255,128,0).
Forms that pass
- Three whole numbers from 0 to 255, separated by commas:
rgb(255, 128, 0) - Three whole percentages from 0% to 100%:
rgb(100%, 50%, 0%) rgba()with an alpha from 0 to 1, with at most two decimals and an optional leading zero:rgba(255, 128, 0, 0.5),rgba(255, 128, 0, .25)orrgba(100%, 50%, 0%, 1)
Forms that fail
The check follows the classic form with commas and keeps to its ranges, so it's stricter than newer browsers, which accept some of these:
- The form with spaces instead of commas, with or without a slash before the alpha:
rgb(255 128 0)andrgb(255 128 0 / 0.5) - An alpha in
rgb(), or none inrgba():rgb(255, 128, 0, 0.5)andrgba(255, 128, 0) - Capital letters:
RGB(255, 128, 0) - Numbers and percentages mixed in one color:
rgb(255, 50%, 0) - Decimals in the channels, as in
rgb(127.5, 0, 0), leading zeros such as05, negative values, and values above 255 or 100% - An alpha above 1, written as a percentage, or with more than two decimals, such as
0.255 - Hex codes such as
#ff8000
Good to know
- With Allow spaces on, the check removes every space before it looks, so
rgb (255, 128, 0)and evenrgb(2 55, 128, 0)pass, though browsers reject both. Turn Allow spaces off if your colors are written without spaces. - To get the hex code of an RGB color, use the RGB to HEX Converter. To find a color by eye, use the Color Picker.
Features
- Checks CSS rgb() and rgba() colors
- Channels from 0 to 255 or in percentages, with an alpha from 0 to 1
- Settings for percentages and spaces
- Results as you type, with no button to press
- Runs in your browser, so nothing you type is sent anywhere