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

How to convert RGB to hex color

Hexadecimal is a base-16 number system: a numeral system made up of 16 symbols. It utilizes numbers from 0 to 9 to represent numbers from 0 to 9, and letters A to F to represent the numbers from 10 to 15.

It is usually used in computer science and mathematics for representing binary code in a human-readable form.

 

What is RGB

RGB - red, green, and blue hues of light which can be mixed to create different colors. This method is used for producing images for TV screens, computer monitors, and smartphone displays.

For more precise, RGB is a color model, meaning one have to add hues together to create a different color.

Difference between Hex and RGB

The main difference between Hex and RGB is- it uses different numeral systems. HEX utilizes hexadecimal, and RGB utilizes decimal.

RGB color

The RGB color is a combination of red, green and blue colors:

(R, G, B)

The red, green and blue use 8 bits each, which have integer values from 0 to 255.

So the number of colors that can be generated is:

256×256×256 = 16777216 = 100000016

Hex color code

Hex color code is a 6 digits 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 to hex conversion

  1. Convert the red, green and blue color values from decimal to hex.
  2. Concatenate the 3 hex values of the red, green and blue togather: RRGGBB.

Example #1

Convert red color (255,0,0) to hex color code:

R = 25510 = FF16

G = 010 = 0016

B = 010 = 0016

So the hex color code is:

Hex = FF0000

Example #2

Convert gold color (255,215,0) to hex color code:

R = 25510 = FF16

G = 21510 = D716

B = 010 = 0016

So the hex color code is:

Hex = FFD700