How to convert from RGB color to hexadecimal color code.
RGB color is a combination of Red, Green and blue colors:
(R, G, B)
Red, green, and blue each use 8 bits, with integer values ranging from 0 to 255.
So the number of colors that can be generated is:
256×256×256 = 16777216 = 100000016
The hex color code is a 6 digit hexadecimal (base 16) number:
RRGGBB16
The 2 left digits represent the red color.
The 2 middle digits represent the green color.
The 2 right digits represent the blue color.
1. Convert the red, green, and blue values from decimal to hex.
2. Combine the 3 hex values of red, green and blue together: RRGGBB.
Example 1
Convert red (255,0,0) to hex color code:
R = 25510 = FF16
G = 010 = 0016
B = 010 = 0016
So the hex color code is:
Hex = FF0000
Example #2
Convert gold color (255,215,0) to hex color code:
R = 25510 = FF16
G = 21510 = D716
B = 010 = 0016
So the hex color code is:
Hex = FFD700
It takes as input red, green and blue color values ranging from 0 to 255 and then converts those values into a hexadecimal string that can be used to specify colors in html/css code. Photo editing software usually represents color in RGB and so if you want to use the colors used in your photo editing software as the background of your HTML element you need to get the hexadecimal representation of RGB values. This tool allows you to get those values.
Try out our new color search tool.
Perhaps you've seen a hex code on a web page and want to use that color in your photo editing software. In that case you will need RGB values if your photo editing software does not support HEX values.
Advertising