About the HEX to RGB
Paste a HEX code like #10b981 and this converter shows the matching rgb() string, along with HSL and CMYK values, a live preview, WCAG contrast, and tints and shades of the color.
How it works
A six-digit HEX code is split into three pairs: the first two digits are red, the middle two are green, and the last two are blue. Each pair is a base-16 number, where the digits run 0-9 and then a-f for 10-15.
To get the decimal value, multiply the first digit of a pair by 16 and add the second. For #10b981, red is 1x16 + 0 = 16, green is 11x16 + 9 = 185, and blue is 8x16 + 1 = 129, giving rgb(16, 185, 129). The tool does exactly this for each pair and also derives the HSL equivalent from the result.
How to use
- 1
Type or paste a HEX code into the Color field, or click the swatch to choose a color.
- 2
Look at the preview box to check the color.
- 3
Read the RGB row for the converted value.
- 4
Click the copy icon next to RGB to copy the rgb() string.
Worked examples
Emerald green
Converting a green accent for a chart library that expects RGB.
10, b9, and 81 in base 16 are 16, 185, and 129 in decimal.
Pure white
Checking the RGB form of white.
ff is the largest two-digit hex value, 255, so every channel is at full intensity.
Without the hash
A code copied from a spreadsheet without the #.
Frequently asked questions
Does this support HEX codes with an alpha channel?+
No. Three- and six-digit codes are accepted. Remove the last two digits of an eight-digit code to convert the color, then add transparency in CSS with rgb() and an alpha value.
Why do some HEX codes have only three digits?+
Three-digit HEX is shorthand where each digit is doubled, so #f00 equals #ff0000. You can enter either form here.
Do I need to include the # symbol?+
No. The converter accepts the code with or without the leading #.
Are HEX codes case-sensitive?+
No. #FF5733 and #ff5733 are the same color, and both convert to rgb(255, 87, 51).
Is any color lost when converting HEX to RGB?+
No. Both formats store the same three 0-255 values, so the conversion is exact in both directions.