Lumaryx

HEX, RGB and HSL Colours Explained (with Quick Conversion Examples)

Updated 2026-11-09

Designers and developers describe the same colour in different formats. Knowing how HEX, RGB and HSL relate lets you pick, adjust and reuse colours without guessing.

The three formats

FormatLooks likeHow it works
HEX#8b5cf6Three pairs of hexadecimal digits for red, green and blue
RGBrgb(217, 164, 65)Red, green and blue, each from 0 to 255
HSLhsl(39, 67%, 55%)Hue (0 to 360 degrees), saturation (%), lightness (%)

All three above describe the same golden colour.

HEX to RGB

Split the HEX into pairs and convert each pair from base 16 to base 10. For #8b5cf6: D9 = 13 × 16 + 9 = 217, A4 = 10 × 16 + 4 = 164, 41 = 4 × 16 + 1 = 65. So the RGB value is (217, 164, 65).

Why HSL is handy

To make a darker button, keep hue and saturation and lower lightness. This is much easier than editing RGB numbers.

Check contrast for readability

Text must stand out from its background. The WCAG accessibility guidelines suggest a contrast ratio of at least 4.5 : 1 for normal text and 3 : 1 for large text. Light grey text on white, or gold on a bright background, often fails. Dark text on a light colour, or light text on a dark colour, usually passes.

Practical tips

Convert instantly

Use our free colour converter to switch between HEX, RGB and HSL in one click.

Free tool: Color Converter

Open the Color Converter
Need help with your marketing?
Lumaryx Digital Agency (Pakistan) helps businesses with Shopify stores, Meta and TikTok ads, SEO, email marketing and web development.

Talk to Lumaryx

Frequently asked questions

What does the # in a HEX colour mean?

It simply marks the value as a hexadecimal colour code. The six characters after it describe red, green and blue.

Which colour format should I use on a website?

HEX, RGB and HSL all work in CSS. HEX is the most common, and HSL is easiest for making lighter or darker shades.

What contrast ratio do I need?

WCAG guidance suggests at least 4.5:1 for normal text and 3:1 for large text.

Related guides