Skip to content
Back to all articles
Developer3 min readNovember 14, 2026

HEX, RGB, HSL and CMYK Colour Codes Explained (and How to Convert Them)

What each colour format means, when to use HEX, RGB, HSL, HSB or CMYK, how transparency works, and how to check that coloured text is readable.

HEX, RGB, HSL and CMYK Colour Codes Explained (and How to Convert Them) article
In this guide
  1. RGB: how screens make colour
  2. HEX: RGB in a short code
  3. HSL: colour the way people think about it
  4. HSV / HSB: what design apps show
  5. CMYK: colour for printing
  6. Transparency: RGBA and 8-digit HEX
  7. Which format to use
  8. Is your coloured text readable?
  9. Finding a colour’s code
  10. Common questions

The same blue can be written as #1E90FF, rgb(30, 144, 255), hsl(210, 100%, 56%) or cmyk(88%, 44%, 0%, 0%). They all describe one colour, just for different jobs. This guide explains each format and when to use it. Convert between any of them instantly with the free Color Converter.

RGB: how screens make colour

Screens mix red, green and blue light. Each channel goes from 0 (off) to 255 (full).

  • rgb(255, 0, 0) is pure red.
  • rgb(255, 255, 255) is white; rgb(0, 0, 0) is black.
  • rgb(30, 144, 255) is “dodger blue”.

HEX: RGB in a short code

HEX writes the same three numbers in base 16: #RRGGBB. 30 = 1E, 144 = 90, 255 = FF, so rgb(30, 144, 255) is #1E90FF.

  • Short form: #F60 means #FF6600.
  • HEX is the most common format in websites, design tools and brand guidelines.

HSL: colour the way people think about it

HSL describes hue (the colour angle on a wheel, 0–360°), saturation (0% grey to 100% vivid) and lightness (0% black, 50% the pure colour, 100% white).

HSL is the easiest format for building variations: keep the hue and saturation, change only the lightness, and you get lighter and darker versions of the same colour for hover states and palettes.

HSV / HSB: what design apps show

HSV (also called HSB) uses hue and saturation too, but value/brightness instead of lightness: 100% is the pure colour, 0% is black. Figma, Photoshop and many colour pickers show HSB, which is why the numbers differ from CSS’s HSL for the same colour.

CMYK: colour for printing

Printers mix cyan, magenta, yellow and black (key) inks. Converting a screen colour to CMYK mathematically gives a starting point, but real printing depends on the paper and the printer’s colour profile. Bright screen colours, especially vivid blues and greens, may not be reproducible in ink at all. For brand work, ask your print shop for a proof.

Transparency: RGBA and 8-digit HEX

Add an alpha value for opacity:

  • rgba(30, 144, 255, 0.5): 50% opacity.
  • #1E90FF80: the same in 8-digit HEX (80 in HEX is 128, about 50%).
  • hsla(210, 100%, 56%, 0.5) in HSL.

Android and Flutter write colours as 0xAARRGGBB, with alpha first: 0xFF1E90FF is fully opaque dodger blue.

Which format to use

JobBest format
Website CSSHEX, or HSL for variations
Overlays and shadowsRGBA or HSLA
Design appsHEX or HSB
Android / Flutter0xAARRGGBB
PrintingCMYK from your printer

Is your coloured text readable?

The WCAG contrast ratio compares how light two colours are. For normal text, aim for at least 4.5:1 (level AA); 7:1 is AAA. Large text needs 3:1. Light grey on white often fails. The converter shows the ratio of your colour on white and on black, plus tints and shades you can switch to if it fails.

Finding a colour’s code

Convert, adjust and check contrast in one place with the Color Converter.

Common questions

Are HEX codes case-sensitive? No. #1e90ff and #1E90FF are the same colour.

Why does my colour look different on another screen? Screens differ in brightness, calibration and colour space, so the same code can look slightly different. Phones in night mode shift colours too.

Can every RGB colour be printed? No. Very bright screen colours, especially vivid blues and greens, fall outside what CMYK inks can reproduce, so printers choose the closest match.

Was this article helpful?

Found this guide useful?

Share it with someone who is struggling with the same problem.

Free tool · No sign-up

Color Converter

Convert colours between HEX, RGB, HSL, HSV, CMYK and CSS names, with transparency, sliders, a contrast check and tints and shades.

Open tool

Written by

Hemant Adhikari HemantInsights

Senior Software Engineer · Developer of Toolyconvert

I’m a senior software engineer from Dehradun, India, building websites since 2014. I designed and developed Toolyconvert, from the Next.js front end and headless WordPress back end to the tools themselves, and I review every guide before it goes live.