#A65CDA colors are called hexadecimal color codes. The six digits were divided into three groups, one for each two-digit number, with the intensity of the red, yellow and blue colors in order. Three groups of digits correspond to three decimal digits in RGB (166,92,218).

So to convert RGB to hexadecimal, you only need to convert three values to hexadecimal. Conversely, reverse conversion.

1. Convert RGB to HEX

There is a one-to-one relationship between RGB and HEX for each color, as shown below:

HEX = ((RGB / 16) -> convert to hexadecimal)

HEX second value = ((RGB value % 16) -> convert to hexadecimal)

RGB: (166,92,218)

166/16 = 10 more than 6 -> A6

92/16 = 5 residual 12 -> 5C

218/16 = 13 residual 10 -> DA

HEX = A65CDA

2. Convert HEX to RGB

This transformation simply reverses the above transformation, as shown below:

RGB value = HEX first * 16 + HEX second

HEX: A65CDA

A6 is 10 and 6 -> 10 times 16 plus 6 is 166

5C = 5 and 12 -> 5 * 16 + 12 = 92

DA = 13 and 10 -> 13 * 16 + 10 = 218

RGB: (166,92,218)