Designers, printers and website builders all ask for colours in different formats. Knowing what each code means saves mismatched logos and reprints. Grab the exact code of any colour in an image with the image colour picker.
Quick answer: A hex code such as #FF5733 is a short way of writing an RGB colour: three pairs of hexadecimal digits for red, green and blue, each from 00 to FF (0 to 255). RGB and hex are for screens. HSL describes the same screen colours by hue, saturation and lightness, which makes lighter and darker shades easy to create. CMYK is for printing with cyan, magenta, yellow and black inks, and Pantone gives exact named ink colours. Screen colours can't always be printed exactly, so check print proofs.
The main formats
| Format | Example | Used for |
|---|---|---|
| Hex | #1A73E8 | Websites, apps, design tools |
| RGB | rgb(26, 115, 232) | Screens, CSS, digital graphics |
| RGBA or 8-digit hex | rgba(26, 115, 232, 0.5) | Colours with transparency |
| HSL | hsl(214, 82%, 51%) | Making tints, shades and themes |
| CMYK | C89 M50 Y0 K9 | Printed materials |
| Pantone | A named swatch number | Signs, packaging, merchandise |
How hex works
Each pair of digits is a number from 0 to 255 written in base 16, where A to F stand for 10 to 15. So #FF0000 is full red with no green or blue, #000000 is black and #FFFFFF is white. Three-digit hex such as #F00 is shorthand where each digit is doubled. Hex codes aren't case-sensitive. Convert between formats with the hex to RGB converter.
Why HSL is handy
Hue is the position on the colour wheel from 0 to 360 degrees, saturation is how vivid it is and lightness runs from black to white. Keep the hue the same and change lightness to make a consistent set of lighter and darker versions of a brand colour, for hover states or backgrounds.
Screen vs print
- Screens mix light (RGB), so they can show brighter, more saturated colours than ink.
- Printers mix ink (CMYK), so bright blues, greens and oranges often look duller on paper.
- Converting RGB to CMYK is an approximation; ask your printer for a proof for important jobs.
- Screens themselves vary, so a colour can look slightly different on each phone or monitor.
Picking colours accurately
- Pick from the original logo file, not a compressed screenshot, where colours can shift.
- Avoid edges and shadows; pick from a solid area.
- Record the codes in every format you need in one place.
Colour and readability
Whatever format you use, check text against its background meets a contrast ratio of at least 4.5:1 for normal text. See how to choose brand colours for building a full palette, and create combinations with the colour palette generator or gradients with the CSS gradient generator. More tools are in the PDF and image tools guide.
General information as at November 2026.
Frequently asked questions
What is a hex colour code?
A six-digit code such as #1A73E8 that sets the red, green and blue values of a screen colour, each from 00 to FF.
What is the difference between RGB and CMYK?
RGB mixes light for screens. CMYK mixes ink for print, and can’t reproduce every bright screen colour.
What is HSL used for?
It describes colours by hue, saturation and lightness, which makes it easy to create lighter and darker shades.
How do I add transparency to a colour?
Use RGBA, HSLA or an 8-digit hex code, where the last value sets opacity.
Why does my logo colour look different when printed?
Ink can’t match every screen colour, and conversions to CMYK are approximate. Ask for a printed proof.
Are hex codes case-sensitive?
No. #ff5733 and #FF5733 are the same colour.
Sources
- MDN Web Docs: CSS colour values
- W3C: CSS Color Module Level 4
- WebAIM: Contrast and colour accessibility
Last updated: