How to convert RGB to HEX

Converting colors from RGB to HEX is as simple as converting their numeric values from decimal to hexadecimal. To convert an RGB color (50, 168, 82), we convert each of the numbers to hex at rgb-hex.net:

  • 50 = 32
  • 168 = A8
  • 82 = 52
  • RGB(50, 168, 82) = #32A852

What is RGB

means red, green and blue shades of light that can be mixed to create different colors. This is the standard method of creating images for TV screens, computer monitors and smartphone displays.

To be more precise, RGB is an additive color model, which means you have to put shades together to create a different color.

Imagine stacking colors one on top of the other:

  • different devices produce different RGB values. Each device uses a different color mixing theory, which means that RGB colors are not the same on all devices, and they need color management to make them look the same.
  • To describe color in the RGB color model, you must specify how much red, green, and blue is needed.
  • You specify how much red, green, and blue is needed using the RGB triplet. (R, G, B) where each of the elements can vary from zero to a certain maximum value.
  • If all elements are zero (0, 0, 0) - the result is black.
  • If all elements are maximum (255, 255, 255) - the result is white.
  • Combinations of these numbers are different colors (255, 255, 0) - the result is yellow
  • This is known as color depth and is measured in bits.
  • As of 2018, almost every TV, computer and smartphone display uses a 24-bit color depth known as true color. It supports eight bits for each of the three colors, or just 24 bits.
  • This provides 28 or 256 possible values for red, green, and blue:
  • 256 x 256 x 256 = 16,777,216 the total number of possible colors in the true color palette.

What is hexadecimal

Hexadecimal describes a number system with a base of 16, consisting of 16 characters. It uses numbers from 0 to 9 to represent numbers from 0 to 9 and letters from A to F to represent numbers from 10 to 15.

It is most often used in computer science and mathematics as a means of representing binary code in a readable form.

Unlike computers or scientists, most of us use the decimal number system. It consists of numbers from 0 to 9 and is the standard way we use numbers. We start learning it in kindergarten and use it every day:

  • a car goes 10 miles an hour
  • A cat weighs 4 pounds.
  • A month consists of 30 days.

Now that we know the difference between hexadecimal and decimal numbers, let's see how we can convert one to the other.

As we already know, in hexadecimal the numbers 0 to 9 represent 0 to 9, and the letters A to F represent 10 to 15 in decimal.