Skip to main content
toolsxulo

How to Convert HEX to RGB, With a Worked Color and Contrast

Written by Toolsxulo Team · Last updated November 4, 2026

The HEX to RGB converter takes a code such as #F2B705 and returns the red, green, and blue values, plus HSL, CMYK, and the contrast against white and black. From there you can copy the value into CSS, or move to the reverse converter and the color picker.

Open the tool: HEX to RGB Converter

The conversion in numbers

Each two-digit hex pair is one channel, from 00 to FF, which is 0 to 255. In #F2B705, F2 is 242, B7 is 183, and 05 is 5, so the converter shows rgb(242, 183, 5). The same color is also hsl(45, 96%, 48%) and cmyk(0%, 24.4%, 97.9%, 5.1%). Contrast for #F2B705 is 1.82 on white (it fails AA) and 11.55 on black (it passes AAA).

Shorthand, and what happens to alpha

A three-digit code is expanded to six digits: #FFF is read as #FFFFFF, which is rgb(255, 255, 255). If you paste a four- or eight-digit value that includes alpha, the converter keeps only the RGB part and drops the alpha. If you need transparency in CSS, write it separately, as rgba() or #RRGGBBAA, outside this tool's output.

When to use HEX and when to use RGB

In CSS both spellings describe the same color. HEX is handy in a design token or a config file. RGB is handy when you want to change one channel, or when you add transparency with rgba(). After the conversion you can open RGB to HEX to get back to a string, or the color picker to adjust the hue on the swatch.

Frequently asked

Is RGB more accurate than HEX?
No. #F2B705 and rgb(242, 183, 5) are the same color in two notations. In this converter, the mapping between a six-digit HEX value and three 0–255 channels is one-to-one.
When should I use RGB instead of HEX in CSS?
When you need transparency in rgba(), or when it is easier to edit one channel as a number. Otherwise HEX is short and easy to copy from the converter or the color picker.
What is the difference between #RGB, #RRGGBBAA, and rgba()?
#RGB is shorthand for #RRGGBB, and this converter does expand it, as with #FFF for white. #RRGGBBAA and rgba() add transparency. This tool returns RGB without alpha, and it ignores an alpha channel if one is present in the input.
Can I convert to HSL as well?
Yes. After you enter a HEX value, the converter also shows HSL and CMYK. For #F2B705 you get hsl(45, 96%, 48%).

Try the tools