hex to RGB

Each pair of hex digits is one channel in base 16, so ff is 255 and 80 is 128.

Paste a hex value. Other formats work too.

RGB
rgb(0 171 231)

Need every format at once? Open in the full picker

Worked examples

Common colors converted from hex to RGB, computed with the same engine the picker uses.

ColorhexRGBCopy
Pure red#ff0000rgb(255 0 0)
Pure green#00ff00rgb(0 255 0)
Pure blue#0000ffrgb(0 0 255)
White#ffffffrgb(255 255 255)
Mid gray#808080rgb(128 128 128)
Black#000000rgb(0 0 0)
Interface blue#4287f5rgb(66 135 245)
Success green#22c55ergb(34 197 94)
Danger red#ef4444rgb(239 68 68)
Warning amber#f59e0brgb(245 158 11)
Editor black#1e1e1ergb(30 30 30)
Warm sand#e9c46argb(233 196 106)

How the conversion works

Each pair of hex digits is one channel in base 16, so ff is 255 and 80 is 128.

Both formats are computed from a single canonical representation (CIE XYZ with a D65 white point, held in floating point) rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a color that cannot be represented in the target format is handled deliberately rather than by accident.

When the source describes a color outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colors.

Related conversions