Color Converter & Contrast Checker

Pick a color or paste a hex code, rgb(), hsl() or CSS name. Get every format with transparency, check it against a background for WCAG AA and AAA, and build tints and shades.

Loading Color Converter & Contrast Checker…

How to Use Color Converter

1

Enter a color in any format

Type a HEX value, rgb() or hsl() function, or a CSS color name such as tomato. The converter recognises the format automatically.

2

Adjust transparency if needed

Use the transparency control to add an alpha channel and get 8-digit HEX, rgba and hsla values.

3

Copy the format you need

Every equivalent value is listed with its own copy button, ready for CSS, a design tool or code.

4

Check contrast against a background

Enter a background color to see the contrast ratio and whether text passes WCAG AA and AAA at normal and large sizes. Swap the two colors to test the reverse.

Color Converter Guide

HEX, RGB and HSL explained

HEX and RGB describe the same thing in two notations: how much red, green and blue light to mix, each from 0 to 255. #3b82f6 is rgb(59, 130, 246), with each pair of hex digits being one channel. Three-digit shorthand such as #fa0 doubles each digit, so it equals #ffaa00. Eight-digit hex such as #3b82f680 adds a fourth pair for transparency.

HSL describes a color the way people think about it: hue as an angle on the color wheel (0 is red, 120 green, 240 blue), saturation as how vivid it is, and lightness from black to white. That makes HSL the easiest format for building palettes, since you can keep the hue and step the lightness to get tints and shades.

When to use each format

Design tools and brand guidelines usually hand you HEX. CSS accepts all three, and modern CSS also supports newer spaces such as oklch(). Use HSL in CSS custom properties when you want to derive hover and disabled states from one base color, and RGB when you need to add transparency with rgb(59 130 246 / 50%). The transparency slider writes 8-digit hex and rgba() for you.

Checking color contrast for accessibility

WCAG 2 measures how readable text is by the contrast ratio between text and background, from 1:1 (identical) to 21:1 (black on white). Level AA needs at least 4.5:1 for body text and 3:1 for large text (24px, or about 19px bold) and for icons and form borders. Level AAA raises that to 7:1 and 4.5:1.

Enter your text color, set the background, and the checker shows the ratio with a pass or fail for each level and a live preview. Translucent colors are blended over the background first, which is what the eye actually sees. If a color fails, click a darker shade or lighter tint from the palette below it until it passes.

Frequently Asked Questions

What contrast ratio do I need for accessible text?

WCAG 2 level AA requires at least 4.5:1 for normal text and 3:1 for large text, which is about 24 px regular or 19 px bold. Level AAA raises those to 7:1 and 4.5:1. Most organizations aim for AA, and many accessibility laws refer to it.

Is HSL better than HEX for CSS?

They describe the same colors. HSL is easier to adjust by hand, because you can change lightness or saturation without touching the hue, which makes it handy for building hover states and color scales. HEX is shorter and is what most design tools export.

What does the fourth pair of digits in an 8-digit HEX mean?

It is the alpha channel. #3b82f680 is the same blue at about 50 percent opacity, because 80 in hex is 128 out of 255. All modern browsers support 8-digit and 4-digit HEX values.

Why does the same HEX look different on two screens?

Screens differ in color gamut, calibration and brightness, and some apps apply color management while others do not. A HEX value is defined in the sRGB color space, so it is consistent in code even when the displayed result varies between devices.

More in Developer Utilities