Color Converter
Convert colors between HEX, RGB, and HSL — with visual preview and WCAG contrast checking
Complementary Color
WCAG Contrast Ratios
What Is a Color Converter?
A color converter translates colors between different representation formats. The three most common formats in web development and design are HEX (hexadecimal notation like #FF5733), RGB (red-green-blue values like rgb(255, 87, 51)), and HSL (hue-saturation-lightness like hsl(11, 100%, 60%)). Each format describes the same color using different mathematical models, and designers and developers frequently need to convert between them depending on the context — CSS stylesheets, design tools, brand guidelines, or accessibility testing.
Understanding Color Models
HEX colors use hexadecimal notation to represent red, green, and blue values as six characters (or three in shorthand). Each pair ranges from 00 (0) to FF (255). HEX is the most common format in CSS and HTML. RGB (Red, Green, Blue) is an additive color model where colors are created by combining red, green, and blue light. Each channel ranges from 0 to 255. When all three are at maximum (255, 255, 255), the result is white; at minimum (0, 0, 0), the result is black. HSL (Hue, Saturation, Lightness) is often preferred by designers because it maps more intuitively to how humans perceive color: hue is the color angle on a 360° wheel, saturation is intensity (0% = gray, 100% = vivid), and lightness is brightness (0% = black, 50% = pure color, 100% = white).
WCAG Contrast Accessibility
The Web Content Accessibility Guidelines (WCAG) define minimum contrast ratios to ensure text is readable for users with visual impairments. The contrast ratio measures the relative luminance difference between foreground text and its background, expressed as a ratio from 1:1 (no contrast) to 21:1 (maximum contrast, black on white). WCAG AA requires a minimum ratio of 4.5:1 for normal text and 3:1 for large text (18px+ or 14px+ bold). WCAG AAA raises these to 7:1 and 4.5:1 respectively. This tool automatically calculates your color's contrast ratio against both white and black backgrounds.
Common Use Cases
- Web development: Convert brand colors from design tools (typically HEX or RGB) to CSS
hsl()for easier manipulation of lightness and saturation variants. - Design systems: Generate color palettes by adjusting HSL lightness values to create consistent light/dark variants of a base color.
- Accessibility audits: Check if text colors meet WCAG contrast requirements against their backgrounds to ensure compliance.
- Email development: Some email clients require HEX colors in inline styles, while CSS-based approaches may use RGB or HSL.