OmniFeed Search

Color converter

Type a color as #hex, rgb(), or hsl(), or pick one, and the converter shows it in all three formats along with how readable white and black text are on it. It measures contrast with the WCAG 2 formula, where body text needs at least 4.5:1. It runs in your browser; nothing you enter is uploaded.

Hex, RGB, and HSL

All three describe the same sRGB color in different ways. #3366ff, rgb(51, 102, 255), and hsl(225, 100%, 60%) are the same blue:

The converter rounds HSL values to whole numbers, so converting to HSL and back can move a color by one step. #6fd3a8 becomes hsl(154, 53%, 63%), and that HSL value comes back as #6fd3a7, a difference no one can see. When you need the exact color, copy the hex value.

How contrast is calculated

The WCAG 2 contrast ratio compares how bright two colors look, which WCAG calls relative luminance. The formula converts each channel from its sRGB value to linear light, then weights it by how sensitive the eye is to that color: luminance is 0.2126 × red + 0.7152 × green + 0.0722 × blue. The ratio is (lighter + 0.05) ÷ (darker + 0.05). It runs from 1:1 for two identical colors to 21:1 for black on white.

Green counts for most of the brightness, which is why light greens need dark text. The default color, #6fd3a8, has a ratio of 1.82:1 with white text and 11.56:1 with black, so put black text on it. Mid grays sit close to the line: #767676 on white is 4.54:1 and passes, while #777777, one step lighter, is 4.48:1 and fails.

Which level you need

Aim for 4.5:1 on all body text, whatever its size, and save the 3:1 large-text allowance for headings. AA is also the level that Section 508 in the US and the EN 301 549 standard in the EU require.

What the converter doesn't handle

More in web and systems

Other tools