HEX to RGB and HSL color converter

Pick a color or type its HEX, RGB or HSL code to get the other formats instantly, with lighter and darker shades and a WCAG contrast check.

Fix the highlighted fields to see your result.

Aa
HEX
—
RGB
—
HSL
—
Contrast with background
—
WCAG AA (normal text)
—
WCAG AAA (normal text)
—

How it is calculated

HEX and RGB represent the same three channels (red, green and blue, 0–255) in base 16 and base 10. HSL is computed from the channel maximum and minimum. Contrast follows the WCAG 2.x relative luminance formula.

Contrast = (L₁ + 0.05) ÷ (L₂ + 0.05)

Assumptions and limitations

  • Colors are in the sRGB space, the web standard.
  • HSL is rounded to whole numbers, so a round trip may differ by one unit.

This tool is educational and provides estimates. It is not a credit offer or financial advice. Actual terms are set by each institution.

Frequently asked questions

How do I convert HEX to RGB?

Split the six-digit code into three pairs and convert each from base 16 to base 10. #0B7A5B → 0B = 11, 7A = 122, 5B = 91 → rgb(11, 122, 91).

What is HSL?

HSL describes a color by hue (0–360°), saturation (%) and lightness (%). It makes it easy to create lighter or darker versions of the same color.

What contrast does text need to be accessible?

WCAG 2.x asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text at level AA; level AAA asks for 7:1 and 4.5:1.