Webenri Free Tools
日本語

HEX, RGB and HSL Color Converter

Convert color codes and check the contrast ratio between two colors.

Common values

Contrast ratios for common color pairs

ForegroundBackgroundRatioAA normal
#000000#FFFFFF21.00:1Pass
#333333#FFFFFF12.63:1Pass
#555555#FFFFFF7.46:1Pass
#767676#FFFFFF4.54:1Pass
#777777#FFFFFF4.48:1Fail
#FFFFFF#0066CC5.57:1Pass
#000000#FFFF0019.56:1Pass
#FFFFFF#0000FF8.59:1Pass
About this tool

Convert HEX colors to RGB and HSL, then calculate the contrast ratio between a foreground and background color. The result includes WCAG AA and AAA checks for normal and large text.

Enter colors as #RRGGBB or the shortened #RGB form. RGB components range from 0 to 255; HSL uses degrees and percentages.

Contrast is calculated from WCAG relative luminance. Threshold checks use the unrounded ratio.

AA requires 4.5:1 for normal text and 3:1 for large text. AAA requires 7:1 and 4.5:1 respectively.

FAQ
How is HEX converted to RGB?
Split #RRGGBB into red, green, and blue pairs, then convert each hexadecimal pair to a decimal value from 0–255. For example, #FF8000 is RGB 255, 128, 0.
What does a 4.5 to 1 contrast ratio mean?
It is the WCAG AA threshold for normal text. This tool calculates relative luminance and marks AA normal text as passing at 4.5:1 or higher.
Can #777777 text be used on white?
Its ratio is about 4.48:1, just below the 4.5:1 AA threshold for normal text. #767676 is about 4.54:1, though actual text size and weight still matter.
Can I enter the shortened #RGB form?
Yes. Each digit is repeated, so #ABC is converted as #AABBCC.

Everything you enter is processed in your browser and never sent anywhere.