How to convert hex to rgb color

How to convert from hexadecimal color code to RGB color.

hex color code
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.

RGB color

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

hex to rgb conversion

1. Take 2 left digits of hex color code and convert to decimal value to get red color level.
2. Get 2 middle digits of hex color code and convert to decimal value to get green color level.
3. Find 2 correct digits of hex color code and convert to decimal value to get blue color level.

Example 1
Convert red hex color code FF0000 to RGB color:

hex = FF0000

So the RGB colors are:

R = FF16 = 25510

G = 0016 = 010

B = 0016 = 010

Or

RGB = (255, 0, 0)

Example #2
Convert Gold Hex Color Code FFD700 to RGB Color:

Hex = FFD700

So the RGB colors are:

R = FF16 = 25510

G = D716 = 21510

B = 0016 = 010

Or

RGB = (255, 215, 0)

 

How to convert RGB to hex ►

 


See also

Advertising

COLOR CONVERSION
°• CmtoInchesConvert.com •°