1. Home
  2. Generators & Encoders
  3. Color Converter

Color Converter

Convert a colour between hex, RGB and HSL, and measure the WCAG contrast against a second colour.

What it is for?
Runs in your browser Free, no sign-up

What it is for?

Design files, CSS and brand guides write colours in different ways. Type a hex colour, or pick one, and this page gives the same colour as hex, RGB and HSL, ready to paste into CSS. The second colour is used to check whether text in the first colour is readable on it.

Contrast

The ratio uses the WCAG relative luminance formula. 4.5 to 1 is the usual minimum for body text, and 3 to 1 for large text. Hex may be written with or without the hash, and a three-digit form is expanded.

The result is graded AAA from 7 to 1, AA from 4.5 to 1, AA large text from 3 to 1, and below AA under that. It does not matter which colour is text and which is background; the ratio is the same.

Example

The default red #f04e54 against white gives about 3.55 to 1. That is enough for a large heading or a button label in bold, but not for body text. Grey #767676 on white is about 4.54 to 1, just above the AA line.

Good to know

  • Input is hex only, in the three or six digit form. rgb() text and eight-digit hex with transparency are not read.
  • HSL values are rounded to whole numbers, so converting them back may move a channel by one step.
  • Contrast is only one part of accessibility. Font size, weight and colour blindness matter too.

It stays in the browser

All conversions run in this tab. Nothing is sent to a server.