HEX to RGB converter

Convert a colour code between HEX, RGB and HSL as you type, and see straight away whether white or black text is readable on it.

Your files stay on your device. Nothing is uploaded.

HEX to RGB converter

Converts as you type

Step 1: Type a colour in any box

Step 2: Preview and contrast

White text Black text
Text colourContrastNormal text (WCAG)
White
Black

How to convert HEX to RGB

  1. Type a colour code

    Type or paste a code into any box: HEX such as #1E8A4C, RGB such as rgb(30, 138, 76), or HSL such as hsl(145, 64%, 33%). Or use the colour picker.

  2. See the other codes

    The other boxes update as you type, together with a large colour preview.

  3. Copy and check contrast

    Click Copy next to the code you need, and check the contrast table before using the colour behind text.

About this tool

HEX, RGB and HSL

HEX writes red, green and blue as two hexadecimal digits each (#RRGGBB). RGB writes the same three values from 0 to 255. HSL describes hue (0 to 360° around the colour wheel), saturation and lightness, which makes it easy to create lighter and darker versions.

Contrast for readable text

WCAG, the web accessibility guideline, asks for a contrast ratio of at least 4.5 : 1 for normal text (level AA) and 7 : 1 for the stricter level AAA. The table shows the ratio of your colour with white and with black text.

Short HEX codes

A three-digit code such as #18A is short for #1188AA: each digit is doubled. The tool accepts both, with or without the #.

Privacy

This tool runs in your browser, on your own device. Your files and text are not uploaded to our server and we cannot see them. When you close or reload this tab, they are cleared, along with the results.

Frequently asked questions

Why do HSL values change slightly when I convert back?

HSL is shown in whole degrees and percentages, so tiny rounding can move a value by 1. The HEX and RGB codes stay exact.

Can I get the colour from a picture?
Is anything sent to a server?

No. The conversion runs in your browser.

Can I make a whole palette?