Skip to content

Color Tools

RGB to HEX

Convert RGB colors to HEX codes instantly with this free online RGB to HEX converter. Enter your red, green, and blue (RGB) values to find the exact HEX color code for web design, CSS, and digital graphics. No signup required.

  • Free
  • No sign-up
  • Runs in your browser

Found a problem with this tool, or have an idea for it?Send feedback

Guide

How to convert RGB to HEX with this tool

  1. Find the three boxes labeled R, G and B. They start at 91, 79 and 240.
  2. Type a number from 0 to 255 into each box.
  3. Look at the panel beneath the boxes. It shows the HEX color code, such as #5B4FF0, in monospace type.
  4. Check the preview swatch on the right to confirm the color looks as expected, then select the code and copy it.

The code updates as you type and everything runs in your browser. There is no copy button, so you select the text yourself. Need the RGB values of a color in a photo or screenshot first? The Image Color Picker reads them from any pixel.

How RGB values become a HEX code

A screen color is made by mixing red, green and blue light. RGB writes each channel as a number from 0 (none) to 255 (full). A HEX code writes the same three channels as two-digit base-16 (hexadecimal) numbers placed one after the other, with a # in front.

To convert RGB to HEX by hand, turn each channel into base 16. For rgb(91, 79, 240): 91 is 5B, 79 is 4F and 240 is F0, giving #5B4FF0. A channel below 16 needs a leading zero, so 5 becomes 05, not 5.

Both notations hold exactly the same information. HEX is simply shorter and is the form most often found in stylesheets, design hand-offs and brand guidelines. These common colors are a handy check:

Color RGB HEX
Black rgb(0, 0, 0) #000000
White rgb(255, 255, 255) #FFFFFF
Red rgb(255, 0, 0) #FF0000
Green rgb(0, 255, 0) #00FF00
Blue rgb(0, 0, 255) #0000FF
Yellow rgb(255, 255, 0) #FFFF00
Orange rgb(255, 165, 0) #FFA500
Gray rgb(128, 128, 128) #808080

For worked examples step by step, read how to convert RGB to HEX.

When you need to go from RGB to HEX

A common case is that a design app, screenshot tool or color sampler reports a color as three separate numbers, while the place you are pasting it into wants a single code. CSS accepts both, but many theme settings, CMS color fields and email builders only take HEX.

It also helps when you are adjusting channels numerically. If you want a slightly stronger red, you can change one number and read off the new code instead of doing base-16 math.

If you are going the other way, the HEX to RGB converter splits a code back into its three numbers.

Common mistakes and limits

Channel values are not checked as strictly as you might expect. If you enter a number above 255 or below 0, the HEX output limits it to the valid range (so 300 behaves like 255 and -10 behaves like 0), and decimals are rounded to the nearest whole number. The result is a valid code, but it may not be the color you meant, so double-check typos such as 2400 for 240.

Clearing a box counts as 0. The tool outputs six-digit uppercase HEX only. It does not produce the three-digit shorthand and does not handle transparency, so rgba() values with an alpha channel cannot be converted here.

To see a color in more notations at once, including HSL and CMYK, use the color converter.

Frequently asked questions

How do I convert RGB to HEX manually?

Convert each of the three numbers to base 16 and join them after a #. Divide the number by 16: the whole result is the first digit and the remainder is the second, with 10 to 15 written as A to F. For example, 240 is 15 × 16 + 0, so F0.

What is rgb(255, 255, 255) in HEX?

It is #FFFFFF, which is white. Each channel at its maximum of 255 becomes FF. All three at 0 gives #000000, which is black.

Is the HEX code uppercase or lowercase?

The tool outputs uppercase letters, such as #5B4FF0. CSS treats uppercase and lowercase HEX codes as identical, so either works when you paste it.

What happens if I type a value over 255?

The tool caps it at 255 when building the HEX code. It does not warn you, so check the numbers if the swatch looks wrong.

My RGB values are percentages. How do I convert them?

Multiply each percentage by 2.55 and round to a whole number, then enter the results. For example, rgb(100%, 50%, 0%) becomes 255, 128 and 0, which is #FF8000.

Can it convert rgba values with transparency?

No. Only the red, green and blue channels are used, and the HEX output has no alpha digits.