Calculator and Converter

RGB to HEX converter

Enter the red, green and blue values from 0 to 255 and this tool shows the matching hex colour code.

Results

Enter your values to see the result.

About this tool

It is useful for web design, CSS and graphics, where a colour given as RGB is needed as a code that starts with a hash.

How it is calculated
each channel (0 to 255) is written as two hexadecimal digits and the three are joined after a #.
Worked example
With Red (0-255): 255; Green (0-255): 128; Blue (0-255): 0, the result is: Hex colour: #FF8000.
Good to know
Each channel from 0 to 255 is written as two hexadecimal digits, and the three pairs are joined after a hash sign. The tool covers the standard RGB colour space used on screens and does not include transparency.

Frequently asked questions

How do I write a colour as a hex code?

Convert each of red, green and blue to a two-digit hexadecimal number and put them after a hash. For 255, 128 and 0, you get FF, 80 and 00.

What is the hex code for white and black?

White is #FFFFFF, where all channels are at the maximum. Black is #000000, where all channels are at zero.

Related calculators