Skip to content

Color Tools

RGB to HEX

Enter red, green, and blue values and get the matching hex code back.

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

Guide

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 numbers placed one after the other, with a # in front.

To convert 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.

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.

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 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.

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, use the color converter.

Frequently asked questions

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.

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.