A brand guide lists the company blue as #1E6FD9. The developer needs it as rgb() with transparency, the designer wants a lighter tint for hover states, and the print shop asks for CMYK percentages. Everyone is talking about the same colour, but in different languages, and small translation errors can leave a logo looking slightly off on a flyer or a button failing accessibility checks.
This guide explains what each common colour format means, how they relate to each other, why screen colours never match print exactly, and how to check that text in your colour is readable. It also shows how to convert between all of them in one place.
Colour models in plain terms
RGB: light on a screen
Screens mix red, green and blue light. Each channel runs from 0 to 255, so rgb(255, 102, 0) means full red, some green and no blue: an orange. Add an alpha channel for transparency: rgb(255 102 0 / 50%).
HEX: RGB in shorthand
A hex code is the same three numbers written in hexadecimal, two digits each:
#FF6600 → FF = 255 red, 66 = 102 green, 00 = 0 blue
Three-digit codes are a shortcut when each pair repeats: #F60 equals #FF6600. Eight-digit codes add alpha at the end.
HSL: how people think about colour
HSL describes a colour by hue (its position on the colour wheel, 0-360 degrees), saturation (how vivid, 0-100%) and lightness (from black at 0% to white at 100%). hsl(24, 100%, 50%) is the same orange as above. HSL is the easiest format for building palettes: keep the hue, change the lightness, and you get a consistent family of tints and shades.
HSV / HSB: how colour pickers work
HSV (also called HSB) uses hue, saturation and value (brightness). Most design app colour pickers use it: the square picks saturation and value, the strip picks hue. It is not used in CSS, but you will meet it in design tools.
CMYK: ink on paper
Printers mix cyan, magenta, yellow and black ink. Values are percentages of ink coverage. CMYK is subtractive: more ink means darker colour, whereas more light on a screen means brighter colour.
CSS named colours
CSS also has around 140 named colours, such as tomato, steelblue and rebeccapurple. They are handy for prototypes, but brand colours almost never match a name exactly.
Why screen and print colours differ
A screen can display many bright, saturated colours that ink simply cannot reproduce, particularly vivid blues, greens and oranges. When you convert RGB to CMYK with a simple formula, you get a mathematically reasonable starting point, not a colour-managed print value. Professional print work relies on colour profiles for the specific paper and press, and on physical proofs. Treat any quick RGB-to-CMYK conversion as an estimate and ask your printer for their recommended profile or a proof.
Convert a colour in every format at once
The Color Converter accepts almost any format and shows the rest instantly.
- Open the Color Converter.
- Under Enter any colour, type or paste a value:
#ff6600,rgb(255 102 0),hsl(24, 100%, 50%), a CSS name such astomato, or use the colour swatch to pick one. The shuffle button gives a random colour. - Read the results in Convert between formats: HEX, RGB, HSL, HSV / HSB and CMYK, each with a copy button. You can also edit any of these fields directly.
- Check CSS name. If your colour exactly matches a named colour, it is shown; otherwise the nearest name is suggested.
- Look at Contrast checker (WCAG 2.1). It shows your colour as text on white and on black, the contrast ratio for each, and pass or fail badges for AA, AA large, AAA and AAA large.
- Use Tints and shades for palettes. Click a swatch to copy its HEX code, or double-click to make it the current colour.
If a value is not recognised, the tool tells you which formats it accepts.
Understanding contrast ratios
WCAG, the web accessibility guidelines, measure contrast between text and background on a scale from 1:1 (no contrast) to 21:1 (black on white). The thresholds used by the tool are:
| Level | Normal text | Large text (18pt, or 14pt bold) |
|---|---|---|
| AA | 4.5:1 | 3:1 |
| AAA | 7:1 | 4.5:1 |
Many mid-tone brand colours, such as bright orange or light green, fail AA as text on white. A common solution is to use a darker shade from the same hue for text and keep the bright version for large headings, icons or backgrounds. To test two specific colours against each other, such as grey text on a coloured panel, use the dedicated colour contrast checker.
Other ways to convert colours
Design software
Figma, Photoshop and similar tools show colours in several formats and handle colour profiles, which matters for print. For anything going to a commercial printer, the design software and the printer's profile should have the final say.
Browser developer tools
In Chrome, Edge and Firefox, you can click a colour swatch in the Styles panel and cycle through HEX, RGB and HSL. Recent versions also show a contrast ratio for text.
Code
CSS itself can now do conversions and mixing with functions like color-mix() and relative colour syntax in modern browsers. For build tools, colour libraries in JavaScript or Python convert between formats in one line.
Tips and pitfalls
Rounding causes tiny drifts
HSL and CMYK values are rounded to whole numbers, so converting HEX to HSL and back can shift a channel by one. Keep one format, usually HEX, as the source of truth for brand colours.
Getting a colour from an image
If you only have a logo file or screenshot, sample the colour first with an image colour picker. The guide on finding the exact colour code in an image explains how to avoid sampling a blurred edge pixel.
Transparency and contrast
Semi-transparent text changes its effective colour depending on what sits behind it, so contrast checks on the base colour may be too optimistic. Test the final blended result.
Building gradients
Tints and shades from the same hue make smooth, cohesive gradients. Take them into the CSS gradient generator, or browse ready-made codes in the HTML colour codes reference.
Frequently asked questions
What is the difference between HEX and RGB?
They describe exactly the same colours. HEX writes the three 0-255 channel values in hexadecimal, while RGB writes them in decimal.
Should I use HSL or HEX in CSS?
Both work everywhere. HSL is easier to adjust by hand, for example lightening a colour by changing one number, while HEX is more compact and common in brand guides.
Why does my printed logo look duller than on screen?
Screens can show brighter, more saturated colours than ink can print. Ask your printer for a colour-managed conversion and a proof rather than relying on a simple formula.
What contrast ratio do I need for body text?
WCAG level AA asks for at least 4.5:1 for normal-sized text. Level AAA asks for 7:1.
Is HSV the same as HSL?
No. Both use hue and saturation, but HSV's value runs from black to the pure colour, while HSL's lightness runs from black through the pure colour to white. The same colour has different saturation numbers in each.