DEV Community

Cover image for Convert RGB Color Code into HEX Code
Snipp It : Free Tools Online
Snipp It : Free Tools Online

Posted on

Convert RGB Color Code into HEX Code

What is RGB Color Model ?
The RGB color model is also seen as an additive color model where the constituent colors, the red, green, and blue, which are the primary colors of light are added in various different ways in different amounts of mixture to generate an array of different colors.

And as such, the name of the model is derived from the all the first letters of the three constituent additive primary colors which are the red, green, and blue colors. One of the important usage of the RGB color code format or the model is to sense, represent, and display images in any electronic media systems computers and televisions.

It is also used in the conventional photographic industry as well. In earlier days, the RGB color model was only a theory as it was dependent on the human or our perception of all the various colors in it.

The RGB Colors are defined with the numbers 0–255, for each of the constituent colors RED, GREEN and BLUE.
In RGB Color space 255, 0, 0 is RED. 0, 255, 0 is GREEN and 0, 0, 255 is GREEN. Basically, assume 0 is black and 255 is white. The mixture of the three primary colors results into a RGB color Code.

What is HEX Color Model ?
Most Designers and developers still use HEX colors codes in web design and development. The HEX color code is shorthand for its red, blue, green values and HSL altogether represent color in different format with a very little conversion tactics in between. No need to sweat the conversion. You can simply use this free RGB to HEX online converter tool or the free HEX to RGB online converter tool to get your desired color values.

A color in the HEX color code format is represented as a 6 digit combination of numbers and letters as defined by the mix of red, green and blue colors in it. If you are aware of the Hexadecimal numbering system, it is pretty easy to follow.

In the Hexadecimal, numbers range from 0–15, which is 0,1,2,3,4,5,6,7,8,9,A (10),B(11),C(12),D(13),E(14) and F(15) just like the number range in decimal system is from 0–9. All other numbers can be formed with these basic numbers.

Now lets look at RED in hex code:

255, 0, 0 (RGB) → FF0000
FF denotes F*16 + F = 15*16 + 15 = 255.

Lets take another example,
An RGB Code of (100, 50, 200) will be same as 6432C8 in Hex format.

64 → 6*16 + 4 = 100
32 → 3*16 + 2 = 50
C8 → C*16 + 8 = 12*16 + 8 = 200

Hope you are now familiar with the HEX and RGB Code mathematical Conversion logic. If you don't want to spend your time doing all this calculation by yourself, we’ve prepared a set of tools to make this easy.

Visit Snipp-It: Free Color Tools Online for our full range of color tools. These are completely free to use.

Some of our other Free Color Tools:
CSS3 Button Generator | CSS Gradient Generator | RGB to HSL Converter |
HEX to HSL Converter | Shades & Tints Generator | Color Shades | Color Chart

Top comments (0)