How to convert HEX to RGB
- Type or paste a color into the box, or pick one with the color square. Any CSS format works, including names like coral.
- Read the same color as HEX, RGB and HSL below, and copy the one you need.
- Check the contrast numbers before using the color behind text.
HEX, RGB and HSL
- HEX writes a color as # and six digits from 0 to F, two each for red, green and blue. #ff0000 is pure red.
- RGB gives the same three amounts as numbers from 0 to 255, as in rgb(255, 0, 0).
- HSL describes the color by hue (0 to 360 degrees around the color wheel), saturation and lightness, which makes it easy to make a shade lighter or darker.
All three describe exactly the same colors, so you can use whichever your design tool or stylesheet expects.
Frequently asked questions
What do the contrast numbers mean?
They compare the color with white and black text using the WCAG accessibility formula. Normal text needs a ratio of at least 4.5 to 1 to be easy to read, and large headings need 3 to 1.
Can I enter a short HEX code like #0a8?
Yes. Three-digit codes are shorthand where each digit is doubled, so #0a8 is the same as #00aa88.
Does it handle transparency?
Yes. Enter an 8-digit HEX code or an rgba() or hsla() value and the alpha is kept in every format.