RGB → HEX

Convert RGB values to HEX colour codes

Turn red, green and blue numbers into the HEX code CSS and design tools expect. Handy when you have sampled a colour from an image, pulled values out of a canvas, or received brand colours specified in RGB and need them in a stylesheet.

How to use it

  1. Enter red, green and blue values, each between 0 and 255.
  2. The HEX code updates live with a colour preview.
  3. Check the swatch against your reference.
  4. Copy the HEX code into your CSS or design tool.

Frequently asked questions

What if my values are decimals between 0 and 1?

Some graphics environments, including OpenGL and certain design tools, normalise channels to 0 through 1. Multiply each by 255 and round before entering them here.

What happens to values outside 0 to 255?

They are clamped to the valid range, because 24-bit colour cannot represent anything beyond it.

How do I convert rgba() with transparency?

Convert the three colour channels here, then append the alpha as a fourth hex pair. An alpha of 0.5 becomes roughly 80, giving an eight-digit code.

Why does my colour look different in the browser?

Colour management. The same RGB triplet can render differently across displays and colour profiles. The values are exact; the perceived appearance depends on the screen.