RGB to Hex | Wikendy
🎯 WIKENDY SEO 🥅 HOSTING 📧 EMAIL MARKETING 💖 DONATE 📚 WIKENDY SCHOOL
Powered by ProofFactor - Social Proof Notifications

RGB to Hex

Search Engine Optimization
HostArmada - Affordable Cloud SSD Web Hosting

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:

HostArmada - Affordable Cloud SSD Web Hosting

About RGB to Hex

A HEX color is expressed as a six-digit combination of numbers and letters defined by its mix of redgreen, and blue (RGB). Basically, a HEX color code is a shorthand for its RGB values with a little conversion gymnastics in between. No need to sweat the conversion.

 

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!