HEX to RGB Converter
Paste a HEX code to get the same color as RGB, plus HSL and CMYK, with a copy button and a contrast check.
HEX
#F2B705
RGB
rgb(242, 183, 5)
HSL
hsl(45, 96%, 48%)
CMYK
cmyk(0%, 24%, 98%, 5%)
Text contrast (WCAG)
As text on white1.82:1
AaAA failAAA fail
As text on black11.55:1
AaAA passAAA pass
How it works
A HEX code writes a color as six digits, two per channel, in base 16. In #F2B705, the pairs F2, B7, and 05 are 242, 183, and 5 in decimal, which is rgb(242, 183, 5). The same color is also shown as hsl(45, 96%, 48%) and cmyk(0%, 24.4%, 97.9%, 5.1%). You can paste the code with or without the #, in six digits or three: #FFF is shorthand for #FFFFFF, which is rgb(255, 255, 255). Under the codes is a contrast check for text on white and on black, using WCAG (AA = 4.5, AAA = 7). #F2B705 on white scores 1.82, so it is not suitable as text on a white background.
Read the full guideHow to use it
- Paste or type a HEX code, with or without the #, in six digits or three.
- The RGB, HSL, and CMYK rows update at once. Copy the code you need.
- Check the contrast to see whether the color is readable as text on white or on black. In supported browsers you can also sample a color from the screen.
Examples
#F2B705rgb(242, 183, 5) / hsl(45, 96%, 48%) / cmyk(0%, 24.4%, 97.9%, 5.1%)
#1C1E22rgb(28, 30, 34) / hsl(220, 10%, 12%)
#FFFrgb(255, 255, 255), which is #FFFFFF
Contrast of #F2B7051.82 on white (fails AA). 11.55 on black (passes AAA).
Frequently asked
- How do I convert HEX to RGB?
- Split the code into three pairs and convert each pair from base 16 to decimal. #F2B705 is F2, B7, and 05, which is rgb(242, 183, 5). In the converter, just paste the code.
- Can I convert a short code like #FFF?
- Yes. Each digit in the short form is doubled: #FFF is #FFFFFF, which is rgb(255, 255, 255). The tool expands it for you.
- What happens if I paste an invalid HEX code?
- A result appears only for a valid 3-, 4-, 6-, or 8-digit code, with or without the #. Anything else shows an error instead of a guess.
- Does the conversion change the color?
- No. HEX and RGB are two writings of the same screen color. #F2B705 and rgb(242, 183, 5) are the same value.
- What is the contrast check for?
- It shows whether the color is readable as text on white or on black. Normal text needs a ratio of at least 4.5 (AA). #F2B705 on white scores 1.82, so it is not suitable as text on a white background.