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.
Step 1: Type a colour in any box
Step 2: Preview and contrast
| Text colour | Contrast | Normal text (WCAG) |
|---|---|---|
| White | ||
| Black |
How to convert HEX to RGB
-
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.
-
See the other codes
The other boxes update as you type, together with a large colour preview.
-
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?
Yes, with Colour picker from image.
Is anything sent to a server?
No. The conversion runs in your browser.
Can I make a whole palette?
Yes, with the Colour palette generator.
Related tools
- COLOR Color picker from image Pick colors from an image and copy HEX, RGB and HSL codes.
- Palette Colour palette generator Make colour palettes from one colour, with CSS codes.
- PNG › ICO Favicon generator Make favicon.ico and app icons from one image.
- Image › text Image to Base64 Turn an image into a Base64 data URI for code.
- SVG › PNG SVG to PNG Turn SVG drawings into sharp PNG images at any size.
- Aa › AA Case converter Change text to upper, lower, title or sentence case.
- PNG › SVG PNG to SVG Trace a PNG or JPG into a scalable SVG drawing.
- QR QR code generator Make a static QR code for a link, text, Wi-Fi, email or phone.