Color Converter

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

Loading tool…

Conversion happens in your browser. No colour values are sent anywhere.

What the Color Converter does

The color converter on this page will convert colours between HEX, RGB, HSL and HSV, with a live preview and WCAG contrast ratios against black and white. Everything runs inside this page, so the work happens on your own device rather than on a server. It is most often used for converting a brand colour from a design file into CSS. For a second version of this color converter, see FreeToolsWorld.org.

How to use it

  1. Enter a colour in any supported format, or use the colour picker.
  2. Every other format is calculated immediately.
  3. Check the contrast ratios if the colour will carry text.
  4. Copy whichever format your stylesheet needs.

How it works

HEX and RGB describe the same thing — the amount of red, green and blue light — just in different notation. HSL and HSV are transformations of the same values into hue, saturation and lightness or value, which are far more intuitive for adjusting a colour: changing lightness in HSL keeps the hue, while adjusting an RGB value shifts everything at once.

The contrast ratios use the WCAG 2.1 relative luminance formula, which applies a gamma correction to each channel before weighting them for human sensitivity to green. Ratios run from 1:1 for identical colours to 21:1 for black on white.

The thresholds that matter: 4.5:1 for normal body text at AA, 3:1 for large text (18pt, or 14pt bold) and for interface components, and 7:1 for AAA. A colour that passes against white will usually fail against black and vice versa, which is why both are shown.

When to use it

  • Converting a brand colour from a design file into CSS.
  • Checking whether text will be readable on a background colour.
  • Adjusting lightness while keeping a hue consistent.

Common mistakes to avoid

  • Assuming a colour that passes contrast against white also passes against black.
  • Checking contrast against the wrong background — it must be the colour actually behind the text.
  • Relying on colour alone to convey meaning, which fails for colour-blind users regardless of contrast.

Frequently asked questions

What contrast ratio do I need?

WCAG AA requires 4.5:1 for normal text and 3:1 for large text and interface components. AAA requires 7:1. Large means 18pt, or 14pt bold.

What is the difference between HSL and HSV?

Both use hue and saturation but differ in the third axis. HSL lightness runs from black through the pure colour at 50 per cent to white; HSV value runs from black to the pure colour at 100 per cent, with white only at zero saturation. HSL is generally easier for picking tints and shades.

Related tools

See all developer tools →