Guides · 2026-03-19

HEX to RGB: How to Convert Colors (With Examples)

Understand HEX and RGB color codes, how to convert between them by hand, and a free tool to do it instantly — plus HSL.

Try the free tool →

HEX and RGB are just two ways of writing the same color. #3B82F6 and rgb(59, 130, 246) are identical — a friendly blue. Here's how the two formats relate and how to convert between them.

What the formats mean

Both describe how much red, green, and blue light to mix. RGB writes each channel as a number from 0 to 255. HEX writes the same three numbers in base-16 (hexadecimal), two digits each, after a #.

Convert HEX to RGB by hand

Split the six HEX digits into three pairs and convert each pair from base-16 to a 0–255 number:

(To convert a pair: multiply the first digit by 16 and add the second, where A–F mean 10–15. So 3B = 3×16 + 11 = 59.)

Convert RGB to HEX

Do the reverse: convert each 0–255 channel to a two-digit hex value and join them. 59 → 3B, 130 → 82, 246 → F6, giving #3B82F6.

What about HSL?

HSL (hue, saturation, lightness) describes color the way humans think — pick a hue, then adjust how vivid and how light it is. It's great for generating tints and shades of one color. Our tool shows HSL alongside HEX and RGB.

Convert instantly

Skip the math: open the free Color Picker, pick or paste a color, and copy it as HEX, RGB, or HSL. Everything runs in your browser.

Try the free tool →

Recommended

Frequently asked questions

What is the RGB value of HEX #FFFFFF?

rgb(255, 255, 255) — pure white. Each channel (FF) is the maximum value, 255.

Is HEX or RGB better for web design?

They're equivalent in result. HEX is more compact for solid colors; RGB (and especially rgba) is handy when you need transparency or to tweak channels in code.