Development and data
How to convert a color between HEX and RGB
HEX and RGB can express the same three color channels in different formats, useful when reviewing an interface.
Before you start
Text is processed in the browser. Consider the content before using it and read the privacy policy.
PrivacyHow to use it
Enter #1a2b3c and convert.
Check the three RGB channel values.
Enter rgb(256,0,0): the out-of-range value is rejected.
Worked example
The hexadecimal pairs 1a, 2b and 3c correspond to 26, 43 and 60 in decimal.
Result: #1a2b3c → rgb(26, 43, 60).
Limits and checks
It accepts three- or six-digit HEX and rgb() with three integers from 0 to 255. Alpha, percentages, CSS names and many other color formats are unsupported; it does not assess contrast or accessibility.
Next step
To prepare an address value, see the URL component guide.
How to encode a value for a URL component