Convert a hex color code to RGB or RGBA instantly — with the reverse RGB-to-hex formula explained.
| Input | Result |
|---|---|
| #4A90D9 | rgb(74, 144, 217) |
| #F60 (3-digit) | rgb(255, 102, 0) |
| #000000 | rgb(0, 0, 0) |
| #4A90D9, alpha 0.5 | rgba(74, 144, 217, 0.5) |
A 6-digit hex code is three two-digit base-16 numbers: pairs for red, green and blue. Convert each pair from hexadecimal to decimal and you have the RGB triplet. #4A90D9: 4A=74, 90=144, D9=217 → rgb(74, 144, 217).
A shorthand where each digit is doubled: #F60 = #FF6600 = rgb(255, 102, 0). Browsers accept both.
Convert each channel to base 16 with two digits and concatenate: 74→4A, 144→90, 217→D9 gives #4A90D9 again. The formula is value.toString(16) in JavaScript.
The fourth value is alpha (opacity) from 0 (transparent) to 1 (opaque) — useful for overlays and shadows. Enter any value between 0 and 1 above.