HEX to RGB Converter

Convert between HEX, RGB, HSL, and CMYK in any direction. Type into any field.

Current Color
#7C3AED
HEX
RGB
HSL
CMYK
CSS Snippet
.element {
  color: #7C3AED;
  color: rgb(124, 58, 237);
  background-color: #7C3AED;
}
Who this tool is for:

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.

ChannelPairArithmeticValue
Red7C7 × 16 + 12124
Green3A3 × 16 + 1058
BlueED14 × 16 + 13237

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.

Frequently Asked Questions

Split the code into three pairs and convert each from base 16 to decimal: multiply the first digit by 16 and add the second, with A to F counting as 10 to 15. For #7C3AED, 7C = 124, 3A = 58 and ED = 237, giving rgb(124, 58, 237). The result is exact.
Not directly. This converter accepts 3 or 6 hex digits and rejects 8-digit codes. In #RRGGBBAA the last pair is alpha: divide its value by 255, so 80 hex (128) gives 128 / 255 = 0.502. Convert the first six digits here and add the alpha yourself.
The tool rounds HSL and CMYK to whole numbers. #7C3AED becomes hsl(262, 83%, 58%), which converts back to #7C3BED. Computed with the tool's own code over 2,396,746 colors, 89.2% changed after a whole-number HSL round trip and 87.3% after CMYK.
Paste the hex as color: #7C3AED, or use rgb(124, 58, 237). For transparency, add an alpha after a slash, as in rgb(124 58 237 / 50%), or use 8-digit hex. CMYK is for print, not CSS. The tool does not output oklch or other CSS Color 4 formats.
In CSS, yes: it marks the value as a hex color. This converter accepts codes with or without it, in upper or lower case, and always shows the result in upper case with the #.
Related Tools

Get fresh reads straight to your inbox

Get notified when we publish new articles. Unsubscribe anytime.