Hex to RGB & WCAG Contrast Checker

Unlock Perfect Color Harmony and Accessibility

UI/UX designers and web developers frequently juggle hex codes, RGB values, and HSL colors, often needing to convert between them while ensuring designs meet accessibility standards. This tool streamlines your workflow by providing instant conversions and a crucial WCAG 2.1 contrast ratio check.

Did you know that the #RRGGBB hex format can encode a staggering 16,777,216 distinct colors? However, simply picking a color doesn't guarantee readability. This converter not only helps you understand your color choices in different formats but also flags potential accessibility issues, as WCAG 2.1 specifies a minimum contrast of 4.5:1 for normal text.

How to Use This Tool

  1. Enter a hex value in the first field (e.g., #ff00ff).
  2. Optionally enter a second hex value to compare contrast.
  3. Review the displayed RGB, HSL, and, if two colors are provided, the contrast ratio and pass/fail badge.

FAQ

Q: How do I convert a 3-digit hex code like #abc to RGB?

A: The tool automatically expands 3-digit shorthand to 6-digit (#aabbcc) before conversion. For example, #abc becomes #aabbcc.

Q: What WCAG 2.1 contrast ratio does the tool calculate for two colors?

A: The tool follows WCAG 2.1 by ensuring the ratio is ≥4.5:1, per the fact that #RRGGBB hex encodes 16,777,216 colors; also checks WCAG 2.1 contrast (4.5:1 minimum for normal text).

Q: Does the tool support uppercase hex letters?

A: Yes, the conversion is case-insensitive, so #FF00FF or #ff00ff both work.

Q: What happens if I input an invalid hex like #12G45Z?

A: The tool validates the input; if the string doesn't match 6 hex digits, it displays an error and clears the output.