Converting HEX Colors to RGB
HEX color codes (#3b82f6) and RGB values (rgb(59, 130, 246)) represent the same colors in different formats. Designers typically provide colors as HEX codes, while programmatic color manipulation often requires RGB (or HSL) values. Our converter translates between all common formats instantly.
The conversion is straightforward: each pair of hex digits maps to a color channel — #3b = 59 red, 82 = 130 green, f6 = 246 blue. But doing this in your head gets old fast, especially when working with multiple colors or adjusting values for hover states and disabled styles.
The tool also shows the WCAG contrast ratio against white and black backgrounds, which is essential for accessibility. WCAG 2.0 requires a minimum 4.5:1 ratio for normal text (AA) and 7:1 for enhanced accessibility (AAA). Check your colors before shipping.
Tips
- CSS accepts both formats:
color: #3b82f6andcolor: rgb(59, 130, 246)are identical. - For opacity, use RGBA:
rgba(59, 130, 246, 0.5)or 8-digit HEX:#3b82f680. - Short HEX notation:
#fffexpands to#ffffff. Each digit is doubled. - Tailwind CSS maps classes to HEX values — use this tool to find the exact class for your design color.