HEX to RGB Converter
Convert a 3-, 4-, 6-, or 8-digit CSS HEX color to RGB channels and ready-to-use CSS.
Try a worked example
Try a worked example
Convert a 3-, 4-, 6-, or 8-digit CSS HEX color to RGB channels and ready-to-use CSS.
Check the units and options, then use the tool’s calculation button. The example is fictitious; replace its values for your own calculation.
Example input
- HEX color
- #3498db
Expected output
CSS color: rgb(52, 152, 219) RGB channels: 52, 152, 219 Alpha: 1 (opaque)
Convert 3-, 4-, 6-, or 8-digit CSS HEX colors into RGB channels and an rgb() CSS value. Four- and eight-digit forms include alpha.
Waiting for the tool. The explanation remains available without JavaScript.
Method and limits
Enter a CSS HEX color with or without #: 3 or 6 digits for an opaque color, or 4 or 8 digits when the last digit or pair sets alpha. The result includes the RGB channels, alpha, and a ready-to-paste CSS rgb() value.
Named colors and other CSS color syntaxes are not accepted.
Share this tool
Only the tool’s public link is shared. Your inputs and results stay here.
Show link to copy manually
Quick answer
Convert 3-, 4-, 6-, or 8-digit CSS HEX colors into RGB channels and an rgb() CSS value. Four- and eight-digit forms include alpha.
The page and its assets load from the site; this operation uses your entered values only in this browser and does not send them to a calculation endpoint.
How to use it
Enter a CSS HEX color with or without #: 3 or 6 digits for an opaque color, or 4 or 8 digits when the last digit or pair sets alpha. The result includes the RGB channels, alpha, and a ready-to-paste CSS rgb() value.
Limits
Named colors and other CSS color syntaxes are not accepted.
Frequently asked questions
Which HEX lengths can include transparency?
Four-digit colors use the last digit for alpha; eight-digit colors use the last byte. In both cases alpha comes after the red, green, and blue channels.
Can I paste the result into CSS?
Yes. The result includes an rgb() or rgba() color value as well as the numeric channels.
Sources and references
These references document the cited standard or browser API; they do not validate the tool’s output.
