Color Converter
Convert a colour between HEX, RGB and HSL, adjust it with sliders, and check its contrast against a background for WCAG AA and AAA, all in your browser.
Enter a colour in any of HEX, RGB or HSL and see it in all three, with a live preview. Sliders for hue, saturation and lightness let you adjust the colour and watch every representation update together. Alpha is carried through, so rgba and hsla values work too. Add a background colour to see the contrast ratio and which WCAG criteria the pair meets.
#00ff88rgb(0, 255, 136)hsl(152, 100%, 50%)#00ff88(the colour entered above)| AA | AAA | |
|---|---|---|
| Normal text | ✗ Fail4.5:1 | ✗ Fail7:1 |
| Large text | ✗ Fail3:1 | ✗ Fail4.5:1 |
| Icons, input borders and other UI parts | ✗ Fail3:1 | — |
The criteria are from WCAG 2.2. Large text means at least 18 pt (24 px), or at least 14 pt (about 18.7 px) in bold.
A semi-transparent text colour is blended over the background, and a semi-transparent background over white.
// Color Converter: Features
Three notations for the same colour
HEX is compact and dominates stylesheets and design tools. RGB maps directly onto how a screen produces colour and is what image processing works in. HSL describes a colour the way a person thinks about it: which hue, how saturated, how light. Having all three visible at once means you can reason in whichever suits the task and copy whichever your code needs.
Why HSL is the one worth learning
Making a colour slightly darker in HEX means changing three hexadecimal pairs and hoping. In HSL it means lowering one number. Building a palette works the same way: fix the hue, vary the lightness, and you have a consistent set of shades; rotate the hue by equal steps and you have a scheme. This is why design systems are increasingly specified in HSL, and why the sliders here adjust in HSL regardless of which notation you typed.
Alpha, and where it is allowed
Transparency is supported throughout: paste an rgba or hsla value and the alpha is preserved, and the outputs use the alpha-bearing forms when it is below one. Modern CSS also accepts eight-digit hex, where the last pair is the alpha, which is worth knowing when you meet one. Note that alpha composites against whatever is behind the element, so the same value looks different over different backgrounds.
Checking contrast against WCAG
A colour that looks fine in isolation may be unreadable as text. WCAG 2.2 asks for a contrast ratio of at least 4.5 to 1 for normal text and 3 to 1 for large text at level AA, and 7 to 1 and 4.5 to 1 at the stricter level AAA. Large text means at least 18 points (24 px), or 14 points (about 18.7 px) in bold, and icons, input borders and other interface parts need 3 to 1. Enter a background colour in the contrast section and the colour above is treated as the text colour: the tool computes the ratio from the relative luminance of both and shows which criteria the pair meets. The ratio is truncated to two decimal places, so a pair that falls just short of a threshold never appears to meet it. Lightness in HSL is a useful guide while you adjust, but it is not the same as measured contrast.
Unreleased brand colours never leave the page
All conversion and adjustment happens locally and nothing is transmitted, stored or logged, so unreleased brand colours are safe to work with here. To build a gradient from the colours you settle on, the CSS Gradient Generator produces the rule directly.
// Color Converter: FAQ
Which formats does it accept?
- HEX in three, four, six or eight digits, RGB and RGBA, comma-separated numbers such as 255, 87, 51, and HSL and HSLA. Paste any of them and the others are produced immediately, with alpha carried through when present.
What is eight-digit hex?
- A HEX colour with an extra pair for alpha, so the last two digits set opacity from 00 for fully transparent to FF for fully opaque. It is supported in all current browsers and is a compact alternative to writing an rgba value.
Why does my semi-transparent colour look different in different places?
- Because alpha composites with whatever sits behind it. The same rgba value over white and over a dark background produces two visibly different results. If you need a fixed appearance, compute the composited colour and use it opaquely.
Does it check colour contrast?
- Yes. Enter a background colour in the contrast section, and the colour above is treated as the text colour. The tool shows the ratio and whether the pair meets the WCAG 2.2 criteria: 4.5 to 1 for normal text and 3 to 1 for large text at AA, 7 to 1 and 4.5 to 1 at AAA, and 3 to 1 for icons and other interface parts. The swap button exchanges the two colours. A semi-transparent text colour is blended over the background, and a semi-transparent background over white.
Are named CSS colours supported?
- The tool works with HEX, RGB and HSL values. Named colours such as those in the CSS keyword list can be converted by looking up their HEX value first, which most editors will show you on hover.
Why does a converted value differ slightly from my design tool?
- Rounding. HSL components are typically stored as integers in CSS, so converting from RGB to HSL and back can shift a channel by one. The difference is imperceptible, but it explains why two tools occasionally disagree in the last digit.
// How to Use Color Converter
-
Enter a colour
Paste a HEX, RGB or HSL value in any of the usual forms, including the alpha-bearing variants. The preview swatch and all three representations update immediately.
-
Adjust with the sliders
Use the hue, saturation and lightness sliders to refine the colour. Working in HSL is what makes building a set of consistent shades practical.
-
Copy the notation you need
Each representation has its own copy button. Take HEX for a stylesheet, RGB for image work, or HSL if your design tokens are specified that way.
Category Design