Color Converter & WCAG Contrast Checker — HEX, RGB, HSL, CMYK

Convert colors bidirectionally between HEX, RGB, HSL, and CMYK with a live color picker and built-in WCAG 2.1 AA/AAA contrast ratio checker.

100% Client-Side • Your data stays in your browser
How to use & FAQ
Loading tool...

Color Converter

Modern design systems and web projects rarely live in a single color model. Brand guidelines arrive in CMYK for print, CSS stylesheets rely on HEX, RGB, or HSL, and accessibility audits require verifying WCAG 2.1 contrast ratios before shipping UI components to production. Our free online Color Converter combines an interactive color picker, instant bidirectional conversion across HEX, RGB, HSL, and CMYK, and a live WCAG 2.1 AA/AAA contrast checker in one workspace. Edit any channel—whether a 6-digit HEX code, an individual RGB byte, an HSL hue angle, or a CMYK ink percentage—and every other format updates immediately inside your browser.

How to Use This Tool

  1. 01 Click the large color swatch to open your native color picker, click a quick preset circle, or type any 3- or 6-digit HEX code (such as #4F46E5 or #09F).
  2. 02 Adjust any numeric field inside the RGB (0–255), HSL (H 0–360°, S/L 0–100%), or CMYK (0–100%) cards to convert bidirectionally in real time.
  3. 03 Click Copy on any card to grab the exact CSS-ready string (HEX, rgb(), hsl(), or cmyk()) for your stylesheet or design tool.
  4. 04 Scroll to the WCAG 2.1 Contrast Checker below to pick a Foreground (Text) and Background color, or click "Use converter color" to pull in your active swatch.
  5. 05 Review the Contrast Ratio readout, the four AA/AAA Pass/Fail badges for normal and large text, and the live typography preview box.

How It Works

Every edit updates a canonical 8-bit sRGB triplet (0–255 per channel) so conversions remain synchronized across all four spaces. HEX encodes red, green, and blue in hexadecimal pairs (00 to FF). HSL transforms RGB into cylindrical coordinates—Hue (0–360°), Saturation, and Lightness—making it intuitive to create lighter tints or darker shades without shifting hue. CMYK computes subtractive print channels by deriving Key (black) as 1 − max(R, G, B) and scaling Cyan, Magenta, and Yellow accordingly. For accessibility, the WCAG 2.1 checker linearizes each sRGB channel using the official 0.04045 gamma threshold to compute relative luminance L = 0.2126·R + 0.7152·G + 0.0722·B, then calculates contrast ratio as (L1 + 0.05) ÷ (L2 + 0.05).

Practical Examples

Converting Brand Indigo Across Web & Print Formats

Input
                      HEX: #4F46E5
                    
Output
                      RGB: rgb(79, 70, 229) • HSL: hsl(243, 75%, 59%) • CMYK: cmyk(66%, 69%, 0%, 10%)
                    

Designers can hand off the CMYK values for brochures while developers paste the exact HEX or HSL tokens into CSS variables.

Checking White Text on an Indigo Primary Button

Input
                      Foreground: #FFFFFF • Background: #4F46E5
                    
Output
                      Contrast Ratio: 6.29:1 • AA Normal: PASS • AA Large: PASS • AAA Large: PASS • AAA Normal: FAIL
                    

A 6.29:1 ratio exceeds the WCAG 2.1 AA threshold (4.5:1) for body text and AAA (4.5:1) for large text, making it accessible for buttons and headings.

Spotting Low-Contrast Placeholder Text

Input
                      Foreground: #94A3B8 • Background: #FFFFFF
                    
Output
                      Contrast Ratio: 2.56:1 • AA Normal: FAIL • AA Large: FAIL
                    

Light slate text on white falls below even the 3.0:1 large-text minimum. Darkening the foreground to #64748B raises contrast to 4.76:1 (AA Pass).

Tips & Best Practices

  • Use HSL when building UI hover states: lowering Lightness (L) by 6–10% creates a natural darker button hover without changing the brand hue.
  • WCAG defines "Large Text" as at least 18pt (24px) regular weight or 14pt (18.66px) bold weight.
  • Always aim for at least WCAG AA (4.5:1) for body paragraphs, form labels, and navigation links, and 3.0:1 for large display headings and UI icons.
  • Because CMYK uses subtractive ink and sRGB uses additive light, bright neon screen colors may look slightly muted when printed—always request a physical proof for critical print runs.
  • Use the Swap FG / BG button to quickly verify whether your color pair works equally well in inverted badges or dark mode.

Frequently Asked Questions

What is the difference between WCAG AA and AAA contrast levels?

WCAG 2.1 Level AA requires at least 4.5:1 contrast for normal text and 3.0:1 for large text (24px regular or 18.66px bold). Level AAA is stricter, requiring 7.0:1 for normal text and 4.5:1 for large text.

Why does converting RGB to CMYK and back sometimes shift values by 1?

RGB uses 0–255 integers while CMYK uses 0–100% integers. Rounding between integer ranges can occasionally shift a channel by ±1, which is visually imperceptible.

Can I enter 3-digit shorthand HEX codes like #F0A?

Yes. Shorthand 3-digit HEX values are automatically expanded to their 6-digit equivalents (#FF00AA) and converted into RGB, HSL, and CMYK.

When should I use HSL instead of HEX or RGB in CSS?

HSL is ideal for creating consistent color palettes, dark-mode surfaces, and hover/active states because you can adjust Saturation or Lightness independently while keeping the exact same Hue.

Does this tool store or upload any colors or palettes?

No. Every conversion and contrast calculation runs 100% locally in your web browser with zero network requests.

Related Tools