RGB to Hex

Search Engine Optimization

RGB to Hex


Enter red, green and blue color levels (0-255) and press the Convert button:

Red color (R):
Green color (G):
Blue color (B):
Color preview:
 
Hex color code:
RGB color code:
HSL color code:

About RGB to Hex

What does this RGB to Hex converter do?

It takes input in the form of values for Red, Green and Blue ranging from 0 to 255 and then converts those values to a hexadecimal string that can be used to specify color in html/css code. Photo editing software usually represents color in RGB and therefore if you would like to use the colors you use in your photo editing software as the background of your html element then you will have to get the hexadecimal representation of the RGB values. This tool allows you to get those values.

Convert a Hex value to RGB

Perhaps you have seen a hex code on a web page and would like to use that color in your photo editing software. In that case you will need the RGB values if your photo editing software does not support hex values.

How Hex Color Codes Work

Most Web graphics software programs convert RGB to Hex without a blink. And for most projects, you'll certainly want to use a tool for making those kinds of calculations. However, if you'd like to understand what's happening behind the scenes, and maybe do your own math to create hex color codes, here's how it works.

If you're familiar with RGB, you know that a specific color is represented by a set of three different numbers: one for red (R), one for green (G), and one for blue (B). For example, the RGB values for a dark, grassy green might be:

R=77

B=131

G=50

With hex codes, a specific color is represented by a single code, which contains a combination of six letters and numbers. To change the three RGB values above into a single hex code, we'll need to make a few conversions. First take your first RGB number and divide that by 16. You can drop the remainder for now and just write down the whole number. This will be the first character in your hex code.

R - 77 / 16 =  4.812 = 4 (first character in code)

Next take the remainder and multiply that by 16. Be sure to round up the final number. This will be the second character in your hex code.

.812 x 16 = 12.99 = 13 (second character in code)

But wait...13 can't be a single character in a hex color code. So we need to use a letter code instead. Numbers between 10 and 15 need to be replaced with the letters A through F (A=10, B=11, C=12, etc). In my example, that means the second character I came up with (13) will now be the letter "D." That makes the first character in my hex code look like this: 4D. That's better. Repeat the whole process above for each RGB number, and presto, you've converted RGB to Hex!

http://ezinearticles.com/?How-Hex-Color-Codes-Work&id=1090408


Share SEO Claims

Buffer Digg Twitter Facebook Google LinkedIn