How to use the HEX to RGB Converter
- 1. Enter a colourType HEX, RGB or HSL, such as #ff5421.
- 2. Convert itThe tool reads the format on its own.
- 3. Copy the codeSee every format and how text looks against it.
How HEX becomes RGB
A HEX colour is three pairs of hexadecimal digits for red, green and blue. Each pair runs from 00 to FF, which is 0 to 255 in decimal. So for #ff5421:
- ff is 15×16 + 15 = 255 red.
- 54 is 5×16 + 4 = 84 green.
- 21 is 2×16 + 1 = 33 blue.
The result is rgb(255, 84, 33), which is hsl(14, 100%, 56%). Short codes double each digit, so #abc means #aabbcc. An 8-digit code adds transparency as the last pair.
HSL is often easier for design work. To make a lighter shade, you only raise the last number and leave the colour itself alone. Want to see the maths on other values? Try the number system converter.
Why the contrast check matters
A colour can look great and still be hard to read as a background. The web accessibility guidelines (WCAG) use a contrast ratio from 1:1 to 21:1, and level AA asks for at least 4.5:1 for normal text.
This tool measures your colour against white and black text and tells you whether each pair passes. Our sample orange has about 3.2:1 with white text, so white body text on it fails AA, while black text passes. Large headings have a lower bar of 3:1.
The CMYK values come from a simple formula and do not take account of paper or ink, so treat them as a starting point and ask your printer for exact values.
Picked your colours? Blend them with the CSS gradient generator, and the code is ready to paste into your stylesheet.
Frequently asked questions
Which colour formats can I enter?
HEX with 3, 4, 6 or 8 digits, rgb() and rgba(), and hsl() and hsla(). The # sign is optional.
What does AA mean in the contrast result?
It is a WCAG accessibility level. Normal text needs a contrast ratio of at least 4.5 to 1 to pass.
Are the CMYK values exact for print?
No. They come from a simple conversion. Ask your printer for colour-managed values.
Is this tool free?
Yes, it is free. We ask for your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.