Color Converter - Hex to RGB or RGB to Hex

Convert between RGB and Hexadecimal.


Copy or paste the color code above

Share on social networks

How does color conversion work?

The tool allows the user to convert colors that are in RGB format to Hexadecimal and also from Hexadecimal format to RGB code. The user can manually edit the color code in the desired fields and when the system identifies that the new color code is valid the other codes will be changed to match the same color entered.

RGB to Hexadecimal

To convert from RGB to Hexadecimal format the user can change the R, G and B values individually or enter a new RGB code in the text field that shows the RGB code of the current color. When an RGB color is changed by a valid new color the RGBA and Hexadecimal code are simultaneously changed to match the new color, which allows the user to acquire the Hexadecimal code with ease.

Hexadecimal to RGB

To convert from Hexadecimal to RGB format the user must replace the value in the text field showing the Hexadecimal color with a new valid code, this way the colors in RGB and RGBA format will be updated to match the new entered color.

RGBA

The RGBA format has an alpha channel that allows the use of the image transparency device, the user must select a value between 0 and 1 in the field above and copy the generated RGBA code. When changing any color code to a valid new value the RGBA code will be updated to match the new entered color.

How to convert from RGB to Hexadecimal?

The RGB code represents the combination of primary colors: red, green and blue. Furthermore, the code is based on the decimal number system, that is, it has 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 which are used to define all the numbers in the system. The Hexadecimal color system also uses as a reference the combination of primary colors, but it is based on the Hexadecimal numbering system, that is, it has 16 characters that are represented by the numbers 0, 1, 2, 3, 4, 5, 6, 7 , 8 and 9 and the letters a, b, c, d, e, f.

To obtain the Hexadecimal representation of the rgb code(0,180,216) it will be necessary to analyze the three numbers of the RGB code, which are separated by commas, and individually divide by 16 to identify the first of the 2 digits of the Hexadecimal sequence, and successively multiply the part decimal by 16 to get the second digit. Both digits obtained with the process described above must be converted to the Hexadecimal number system, that is, starting from 0 to 9 and after that from a to f.

First value

Step 1: 0 divided by 16 results in 0;

Step 2: We identified that the result of the division and the decimal part is zero;

Step 3: We have that the first and second digits will be represented by the characters f in both positions.

Second value

Step 1: 180 divided by 16 results in 11.25;

Step 2: We must remember that we start counting from 0 to 9 and then from a to f, so 11 is represented by the character b;

Step 3: We take the remainder and multiply it by 16. 0.25 * 16 = 4. So the fourth digit is 4.

Third value

Step 1: 216 divided by 16 results in 13.5;

Step 2: The value 13 is represented by the character d and is present in the fifth position of our Hexadecimal code;

Step 3: We take the remainder and multiply by 16. 0.5 * 16 = 8. So 8 is our sixth and last digit.

Hexadecimal code obtained: #ffb4d8

How to convert from Hexadecimal to RGB?

To obtain the RGB representation of the code #ffb4d8 we must first divide the code into 2-digit sequences and analyze each part of the sequence individually, obtain the decimal representation of the first digit, multiply by 16 and add the result obtained with the decimal value of the second digit . By repeating this step for each part of the sequence, users can obtain the RGB representation of the code presented above.

First value

Step 1: The digit 0 in the decimal system is also represented with the digit 0;

Step 2: Multiplying 16 by zero we get 0 as a result;

Step 3: Adding 0 to 0, we get 0;

Step 4: Therefore, the representation in the RGB system is 0.

Second value

Step 1: The digit b is represented by the value 11 in the decimal system;

Step 2: The value 11 multiplied by 16 results in the value 176;

Step 3: The digit 4 is represented by the value 4 in the decimal system;

Step 4: The sum of the values ​​176 and 4 results in 180.

Third value

Step 1: The digit d is represented by the value 13 in the decimal system;

Step 2: The value 13 multiplied by 16 results in the value 208;

Step 3: Digit 8 is represented by the value 8 in decimal system;

Step 4: The sum of the values ​​208 and 8 results in 216.

RGB code obtained: rgb(0, 180, 216)