HEX to RGB Converter
Convert between HEX, RGB, HSL, and CMYK in any direction. Type into any field.
.element {
color: #7C3AED;
color: rgb(124, 58, 237);
background-color: #7C3AED;
}
Best for: Converting a hex from a brand guide into the RGB a design tool needs, and translating between hex, RGB, HSL and CMYK in one step
Limitations: Converts colour values and does not check contrast or accessibility, so legibility still needs testing separately
Best suited for: Developers translating brand documentation into the format their tooling expects
Worked Conversion: #7C3AED
Type into any field and the others update. To convert HEX to RGB by hand, split the code into three pairs and read each as a base-16 number: the first digit counts sixteens, and A to F stand for 10 to 15.
| Channel | Pair | Arithmetic | Value |
|---|---|---|---|
| Red | 7C | 7 × 16 + 12 | 124 |
| Green | 3A | 3 × 16 + 10 | 58 |
| Blue | ED | 14 × 16 + 13 | 237 |
So #7C3AED is rgb(124, 58, 237). Three-digit shorthand doubles each digit, so #73E is read as #7733EE. Upper and lower case both work, with or without the #.
8-Digit Hex and Alpha
CSS also accepts #RRGGBBAA, where the last pair is alpha: 00 is fully transparent and FF fully opaque. Divide the pair's value by 255: in #7C3AED80, 80 hex is 8 × 16 = 128, and 128 / 255 = 0.502, so about half opaque.
This converter does not read that format. It accepts 3 or 6 hex digits only, so an 8-digit code shows "Invalid value". Convert the first six digits, then add the alpha yourself, for example rgb(124 58 237 / 0.502).
Rounding Limits
HEX and RGB convert exactly. HSL and CMYK are shown as whole numbers, so a round trip can drift: #7C3AED shows as 262, 83%, 58%, which converts back to #7C3BED, and as 48, 76, 0, 7 in CMYK, which converts back to #7B39ED. Computed with this tool's own code over 2,396,746 colors, 89.2% changed after whole-number HSL, by up to 4 levels in a channel, and 87.3% after whole-number CMYK (method). The HSL and CMYK fields accept decimals as input, but the outputs are always whole numbers, so keep the hex or RGB as your master value.
What It Does Not Do
No alpha field, no 8-digit hex, and no oklch, lab or other CSS Color 4 formats. CMYK uses a plain formula with no printer profile. It does not check contrast; use the contrast checker. For the full background, including code, read the RGB to HEX guide.