How to convert HEX to RGB
A HEX code is three pairs of hexadecimal digits for red, green and blue. Convert each pair from base 16 to base 10. For #FF5733: FF = 255, 57 = 87, 33 = 51, so the result is rgb(255, 87, 51). Three-digit codes like #F53 are shorthand: each digit is doubled, giving #FF5533.
How to convert RGB to HEX
Do the reverse: convert each channel (0-255) to a two-digit hexadecimal number and join them. rgb(91, 75, 255) becomes 5B, 4B, FF, so the HEX code is #5B4BFF.
Which color format should I use?
- HEX: the most compact; the standard in CSS, Figma and most design tools.
- RGB: how screens mix light; handy when you need transparency via
rgba(). - HSL: the easiest to tweak by hand. Change lightness for a darker hover state, or hue for a variation.
- CMYK: used for printing. The values here are a mathematical approximation; your printer's color profile decides the final result.
Frequently asked questions
What does the WCAG contrast ratio mean?
It measures how readable text is on a background, from 1:1 (invisible) to 21:1 (black on white). Normal text needs at least 4.5:1 (level AA) and large text needs 3:1. Level AAA requires 7:1.
What is the difference between tints and shades?
A tint is the color mixed with white, so it gets lighter. A shade is the color mixed with black, so it gets darker. Both are useful for building hover, active and background states from one brand color.
Can I convert a color from a picture?
Yes. Use the Image Color Picker to get the code from any pixel, then come back here for shades and harmonies.