Color format converter

Color format converter

Convert between HEX / RGB / HSL with a live preview

Computed in your browser

Enter a HEX, rgb() or hsl() color to preview and convert it. Alpha appears in output formats that support transparency.

HEX
RGB
HSL

Example

Input

#ff000080

Example result

rgba(255, 0, 0, 0.502)
hsla(0.0, 100.0%, 50.0%, 0.502)

Hex 80 equals 128, so alpha is 128/255, slightly above 0.5.

Technical details & limits

RGB channels use 0–255; HSL hue wraps around 360 degrees with percentage saturation and lightness. Hex alpha comes last, unlike ARGB, and conversion to eight-bit alpha rounds values. This is an sRGB converter, not a CMYK, ICC color-management or WCAG contrast tool.

About this tool

Convert colors between HEX, RGB/RGBA and HSL/HSLA with a live swatch. Compare design values, adjust CSS colors and inspect alpha using common short and alpha-bearing hex formats.

Use cases

  • The design ships HSL and the frontend wants HEX or RGBA.
  • Rewrite CSS custom properties into a different format en masse.
  • Sanity-check what a color actually looks like from the code.

How to use

  1. Enter a colour in HEX, RGB or HSL.
  2. The other notations appear together with a preview swatch.
  3. Input carrying transparency keeps its alpha channel.

Notes

Color-space conversion rounds; a round trip can shift a channel by 1. HSL hue is normalised to 0–360°.

FAQ

What channel range does HEX-to-RGB conversion use?
HEX-to-RGB conversion produces red, green, and blue channel values from 0 through 255. A 6-digit HEX color assigns 2 hexadecimal digits to each channel, with FF representing 255. Alpha, when included, is placed at the end rather than the beginning. Verify the channel order before transferring a value from an ARGB-based system, because the same digits in a different order describe a different color.
Are HSL hue values of zero and 360 degrees equivalent?
HSL hue wraps around every 360 degrees, so 0 and 360 identify the same hue direction. Saturation and lightness are percentages, normally ranging from 0 to 100. Colors with the same hue can still look different when either of those percentages changes. This converter works with sRGB values and does not predict print output, color-managed device behavior, or a final appearance after a transparent color mixes with its background.
Why can converting RGBA alpha to eight-bit HEX introduce rounding?
Converting RGBA alpha to HEX quantizes it to an 8-bit integer, so small rounding differences are expected. The range from 0 to 1 maps to 0 through 255; for example, 0.5 rounds to 128. Converting that integer back need not reproduce the original decimal exactly. The displayed preview can also differ with its background, because transparency affects the final blended color rather than only the stored channel values.

Related tools

Color format converter · Convert between HEX / RGB / HSL with a live preview
Color format converter — Tool illustration · dayeku.com