RGB to Hex and Hex to RGB Converter

About RGB to Hex and Hex to RGB Converter

To convert RGB to Hex, you need to enter three RGB color values into individual fields corresponding to the colors: red, green, blue. After entering these values, it will be converted and displayed as a hexadecimal number (hex code). You can select the converted value and copy it to the clipboard or simply click the Copy Hex button.

To convert Hex code to RGB, enter the hexadecimal color value in the Hex code> field. After entering it, it will be converted to the corresponding RGB color. To copy the RGB color value, click the Copy RGB button.

What's RGB?

RGB is one of the color space models described by the RGB coordinates. Its name is derived from the first letters of the color names: R - red, G - green, and B - blue, of which this model is composed. It is a model resulting from the perception properties of the human eye, in which the impression of seeing any color can be evoked by mixing in fixed proportions three beams of light of red, green, and blue.

The RGB model is widely used in image analysis devices (e.g. digital cameras, scanners) and image display devices (e.g. TV sets, computer monitors).

From a combination of RGB colors in any quantitative combination, a wide range of derivative colors can be obtained, e.g. a combination of green and red produces yellow. For the RGB space an additive synthesis is applied, where the lowest values mean black and the highest values mean white. However, the RGB model is theoretical, and its representation depends on the device, which means that in each device each of the RGB components may have slightly different spectral characteristics, and thus, each of the devices may have its range of colors possible to obtain.

Colour recording as RGB is often used in computer science (e.g. color palettes in graphic files, in Html files). The most commonly used is 24-bit color writing (8 bits for each of the component colors), in which each of the colors is written using the components that take a value from the range 0-255. In the RGB model, the value 0 of all the components gives a black color, while 255 - white color.

The RGB colour can be calculated from the formula: colour number = R ⋅ 65536 + G ⋅ 256 + B where R, G, and B take a value between 0 and 255.

What is the Hex triplet

A hexadecimal record consists of six hexadecimal digits (three bytes). According to the RGB (red, green, blue) model, the bytes are red, green, and blue. Each byte can take a value from 00 (0) to FF (255), which means the lowest and highest intensity of a given color respectively.

Even if the intensity of a color is less than 16 (which gives one digit in hexadecimal notation), the notation has 6 digits. For example, one of the dark blue hues, where the intensity of red is A, green 2, and blue 66, is 0A0266. The recording can only be shortened if each byte consists of two identical digits, e.g. the example AABBCC can be written as ABC.

In this system you can write 256 × 256 × 256 = 16777216 different colors.

The hexadecimal record is used in HTML and CSS, SVG vector graphics format, and other applications. Converting hexadecimal to RGB is about saving the decimal values of consecutive pairs of hexadecimal digits, e.g. 0FAB40 = RGB(15, 171, 64).

Sample colors saved in RGB and Hex.

In the table below there are examples of colors that are stored in RGB and Hex. If you are looking for a color, you can try it by name.

# name RGB code Hex code
1 white 255,255,255 #FFFFFF
2 silver 192,192,192 #C0C0C0
3 gray 128,128,128 #808080
4 black 0,0,0 #000000
5 red 255,0,0 #ff0000
6 maroon 128,0,0 #800000
7 yellow 255,255,0 #ffff00
8 olive 128,128,0 #808000
9 lime 0,255,0 #00ff00
10 green 0,128,0 #008000
11 aqua 0,255,255 #00ffff
12 teal 0,128,128 #008080
13 blue 0,0,255 #0000ff
14 navy 0,0,128 #000080
15 fuchsia 255,0,255 #ff00ff
16 purple 128,0,128 #800080
17 pink 255,192,203 #FFC0CB
18 orange 255,165,0 #FFA500
19 brown 165,42,42 #A52A2A
20 gold 255,215,0 #FFD700