HEX to RGB Converter – Convert Colour Codes to RGB, HSL and CMYK
Paste a HEX, RGB or HSL colour — or pick one — and get every format at once, with a live preview and contrast ratios against white and black.
Split the HEX code into three pairs and convert each from base 16 to base 10: #7C3AED → 7C = 124, 3A = 58, ED = 237, so rgb(124, 58, 237). The converter does this instantly in both directions and also shows HSL and CMYK.
How to use HEX to RGB Converter
- Type or paste a colour such as #7c3aed, 124, 58, 237 or hsl(262, 83%, 58%).
- Or click the colour swatch to pick a colour.
- Read the HEX, RGB, HSL and CMYK values.
- Check the contrast ratio on white and black.
- Copy the format you need.
How HEX colours work
A HEX colour such as #7C3AED is three pairs of hexadecimal digits: red, green and blue. Each pair runs from 00 (0) to FF (255). Converting to RGB simply means turning each pair into a decimal number:
7C → 7 × 16 + 12 = 124, 3A → 3 × 16 + 10 = 58, ED → 14 × 16 + 13 = 237
So #7C3AED is rgb(124, 58, 237). Short codes like #F80 double each digit (#FF8800), and 8-digit codes like #7C3AED80 add an alpha channel for transparency.
Common colours
| Colour | HEX | RGB |
|---|---|---|
| White | #FFFFFF | 255, 255, 255 |
| Black | #000000 | 0, 0, 0 |
| Red | #FF0000 | 255, 0, 0 |
| Green | #00FF00 | 0, 255, 0 |
| Blue | #0000FF | 0, 0, 255 |
| Orange | #FF8800 | 255, 136, 0 |
When to use each format
- HEX is compact and the most common in CSS, design tools and brand guides.
- RGB / RGBA is handy when you need transparency or calculate colours in code.
- HSL describes hue, saturation and lightness, so it is the easiest format for making a colour lighter, darker or less saturated.
- CMYK is used for print. The values here are a simple conversion; for professional printing, ask your printer for the right colour profile.
Contrast and accessibility
Text must stand out from its background to be readable. The WCAG guidelines ask for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. The converter shows the ratio of your colour on white and on black, so you can see immediately whether it works for text or only for decoration.
Private and instant
All conversions happen in your browser while you type. Developers will also like the JSON Formatter and the Base64 Encode / Decode encoder; designers can prepare images with the Image Resizer.
You may also find these free tools useful: JSON Formatter, Password Generator and Regex Tester.
Frequently asked questions
How do I convert HEX to RGB?
Split the code into three pairs and convert each from hexadecimal to decimal. #FF8800 becomes 255, 136, 0.
How do I convert RGB to HEX?
Convert each value from 0 to 255 into two hexadecimal digits and join them: 255, 136, 0 becomes #FF8800.
What is a 3-digit HEX code?
A shorthand where each digit is doubled: #F80 is the same as #FF8800.
What does the alpha value mean?
Alpha is opacity, from 0 (transparent) to 1 (solid). In 8-digit HEX it is the last pair, from 00 to FF.
What contrast ratio do I need for text?
At least 4.5:1 for normal text and 3:1 for large text, according to WCAG AA.
Last updated: