DEVELOPER TOOLS

Colour converter: HEX, RGB and HSL

Pick a colour or type a HEX or RGB code to get the same colour in HEX, RGB and HSL, plus its inverse.

  • Free, no sign-up
  • Runs privately in your browser
  • Instant results

How to use the colour converter

  1. Pick a colour with the colour picker, or type a code such as #1E7A6C or rgb(30, 122, 108).
  2. Copy the HEX, RGB or HSL value you need.
  3. Use the inverse colour as a starting point for a contrasting accent.

HEX, RGB and HSL explained

HEX writes red, green and blue as pairs of hexadecimal digits, so #FF0000 is pure red. RGB writes the same three values as numbers from 0 to 255. HSL describes hue (0–360°), saturation and lightness, which makes it easier to create lighter or darker versions of a colour. All three work in CSS.

Check contrast for accessibility

An inverse colour is not always readable on the original. For text, check that the contrast ratio meets WCAG guidance: at least 4.5:1 for normal text.

Worked example

Typing #1E7A6C gives rgb(30, 122, 108) and an HSL value of roughly hsl(171, 61%, 30%): a teal hue, fairly saturated and quite dark. Its inverse is #E18593, a soft pink.

To make a lighter tint of a colour for a background, keep the hue and saturation in HSL and raise the lightness. To make a darker shade for text or borders, lower the lightness. This keeps a colour palette consistent across a website or brand.

The converter accepts six-digit and three-digit HEX codes, with or without the #, and RGB values written with commas or spaces.

Frequently asked questions

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each from hexadecimal to a number. #1E7A6C becomes rgb(30, 122, 108). The converter does this for you.

Does it support three-digit HEX codes?

Yes. Short codes such as #FA0 are expanded to #FFAA00.

What is an inverse colour?

Each RGB value is taken away from 255. The inverse of white is black.