Media & Design

Hex to RGB

Convert colours between hex, RGB and HSL.

The first non-empty field is used, in order: hex, then RGB, then HSL.

Results appear here.

What the result means

The first field that is not empty is the source, checked in order: hex, then RGB, then HSL. A short hex color such as #fff is expanded by doubling each digit, so it is the same color as #ffffff. Six-digit hex is read as two digits per channel. RGB channels are whole numbers from 0 to 255. Anything outside that range is an error, not a clipped color. HSL uses a hue from 0 to 360 and saturation and lightness from 0 to 100. Those are converted through RGB, then back out to the other two forms. Rounding can shift a channel. The swatch is the hex color the page settled on.

Related tools

Advertisement

Questions

What is #fff?

#fff is shorthand for #ffffff. Each digit is doubled, so it is the same color as white in six-digit form. The page accepts both #RGB and #RRGGBB.

Which range is HSL?

Hue runs from 0 to 360. Saturation and lightness run from 0 to 100. A value outside those ranges is an error. The page does not wrap a hue of 400 back into range.

What if more than one field is filled?

Hex is used when it is not empty, then RGB, then HSL. Later fields are ignored for that run. Clear the earlier field if you want a different source.