Convert4Me – Convert4Me home

HEX, RGB and HSL: Color Formats Explained (With Conversions)

Updated October 22, 2026

A color can be written many ways. This guide explains the main formats, how to convert between them, and how to check that your text colors are readable.

The same color in every format

Here is one indigo color, #4F46E5, written five ways:

FormatValue
HEX#4F46E5
RGBrgb(79, 70, 229)
HSLhsl(243, 75%, 59%)
HSVhsv(243, 69%, 90%)
CMYKcmyk(66%, 69%, 0%, 10%)

How to convert HEX to RGB by hand

Split the six digits into three pairs, and read each pair as a base-16 number from 00 (0) to FF (255).

  • 4F = 4 × 16 + 15 = 79 (red)
  • 46 = 4 × 16 + 6 = 70 (green)
  • E5 = 14 × 16 + 5 = 229 (blue)
  • So #4F46E5 is rgb(79, 70, 229).

When to use each format

  • HEX: the usual way to write colors in CSS, design tools and brand guides.
  • RGB: when you need to add transparency (rgba) or work with code that mixes channels.
  • HSL: when you want to adjust a color, because you can change lightness or saturation and keep the same hue.
  • HSV: in many color pickers (hue, saturation, brightness).
  • CMYK: for printing, although the exact result depends on the printer and paper.

Making text readable: contrast

Accessible design needs enough contrast between text and its background. The WCAG guidelines measure it as a ratio:

LevelNormal textLarge text
AA (the usual target)4.5 : 13 : 1
AAA (stricter)7 : 14.5 : 1

Quick examples

  • #4F46E5 on white has a contrast of about 6.3 : 1, so it passes AA for normal text.
  • #767676 on white is about 4.5 : 1, the lightest gray that passes AA. #777777 is just under it.
  • Check any pair with the contrast check in the Color Converter.

Frequently asked questions

How do I write a color with transparency in CSS?

Use rgb(79 70 229 / 50%), rgba(79, 70, 229, 0.5), hsl(243 75% 59% / 50%) or an 8-digit HEX such as #4F46E580, where the last two digits are the opacity.

What does #FFF mean?

It is short for #FFFFFF, white. Three-digit HEX codes repeat each digit, so #4AF means #44AAFF.

Your privacy comes first. Your text and numbers stay in your browser and we never see them. If you allow it, we save what you type on this device and use Google Analytics to count visits. We never sell your data. Privacy Policy