Color Converter

Convert colours between HEX, RGB and HSL, with a live swatch and contrast ratios against white and black.

Web ToolsFreeNo sign-up
Runs in your browser. Nothing you enter is uploaded.

01How to use the Color Converter

  1. 01Type a colour in any supported format, or use the colour picker.
  2. 02See it converted to HEX, RGB and HSL.
  3. 03Copy the value you need.

02Conversion formulas

HEX → RGB: each pair of hex digits is one channel (00–FF = 0–255)

RGB → HSL (channels scaled to 0–1):
  L = (max + min) ÷ 2
  S = (max − min) ÷ (1 − |2L − 1|)
  H = 60° × position of the largest channel

Contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05)  (WCAG 2)

03Examples

#1E90FF = rgb(30, 144, 255) = hsl(210, 100%, 56%).

Short hex #f80 expands to #FF8800.

Pure white on black has the maximum contrast ratio, 21 : 1.

04Frequently asked questions

Why don’t HSL values round-trip exactly?

HSL is shown rounded to whole numbers. Converting the rounded value back can shift an RGB channel by one.

Is transparency supported?

Alpha values in rgba() or hsla() are accepted but ignored. Results describe the opaque colour.

What contrast ratio do I need?

WCAG 2 asks for at least 4.5 : 1 for body text and 3 : 1 for large text and interface elements.