Home › Unit Converters › RGB to HEX Converter

RGB to HEX Converter

Convert RGB to HEX with this free RGB to HEX converter. Move the sliders or type the red, green and blue values, and you get the HEX code instantly — plus the HSL values, a live preview of the colour, and a ready-to-paste CSS snippet. You can also paste a HEX code to go the other way. It is made for web designers, students, and anyone matching a colour between a photo tool and a website.

#FF6347
rgb(255, 99, 71) • hsl(9, 100%, 64%)
CSS: color: #FF6347; /* rgb(255, 99, 71) */

How to use this converter

Step 1: Move the red, green and blue sliders, or type exact numbers into the small boxes — tomato (255, 99, 71) is filled in as an example.
Step 2: Watch the preview box to confirm the colour looks right.
Step 3: Read the HEX code in the big result, along with the HSL values and the CSS line, which you can copy straight into a stylesheet.
Step 4: To go the other way, type a HEX code into the top box (with or without the #) and press Enter or click away — the sliders and numbers jump to that colour.

Common colours

ColourHEXRGBHSL
Red#FF0000rgb(255, 0, 0)hsl(0, 100%, 50%)
Tomato#FF6347rgb(255, 99, 71)hsl(9, 100%, 64%)
Orange#FFA500rgb(255, 165, 0)hsl(39, 100%, 50%)
Gold#FFD700rgb(255, 215, 0)hsl(51, 100%, 50%)
Yellow#FFFF00rgb(255, 255, 0)hsl(60, 100%, 50%)
Green#008000rgb(0, 128, 0)hsl(120, 100%, 25%)
Teal#008080rgb(0, 128, 128)hsl(180, 100%, 25%)
Sky Blue#87CEEBrgb(135, 206, 235)hsl(197, 71%, 73%)
Blue#0000FFrgb(0, 0, 255)hsl(240, 100%, 50%)
Navy#000080rgb(0, 0, 128)hsl(240, 100%, 25%)
Purple#800080rgb(128, 0, 128)hsl(300, 100%, 25%)
Pink#FFC0CBrgb(255, 192, 203)hsl(350, 100%, 88%)
Brown#A52A2Argb(165, 42, 42)hsl(0, 59%, 41%)
Gray#808080rgb(128, 128, 128)hsl(0, 0%, 50%)
Black#000000rgb(0, 0, 0)hsl(0, 0%, 0%)
White#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)

How it works

RGB and HEX are two ways of writing the same colour. RGB lists three numbers — how much red, green and blue light to mix, each from 0 to 255. HEX writes the same three numbers in base 16 (hexadecimal), using digits 0–9 and letters A–F, packed into six characters after a #. So the conversion is simply changing each number from decimal to hexadecimal and padding it to two characters.

HEX = # + hex(R) + hex(G) + hex(B), each padded to 2 digits  |  255 = FF, 99 = 63, 71 = 47, so rgb(255, 99, 71) = #FF6347  |  Short form: #F60 means #FF6600 — each digit is doubled

Websites use HEX in CSS because it is short and exact. Image editors usually show RGB because the three sliders match how screens actually mix light. HSL is a third way, based on hue (the colour itself, in degrees around a wheel), saturation (how strong it is) and lightness (how bright) — designers like it for making matching lighter and darker shades of one colour, which is why this tool shows it too.

Because each channel has 256 levels, RGB can describe 256 × 256 × 256 = 16,777,216 colours — often called 16.7 million colours, or 24-bit colour. The HEX code holds exactly the same information, never more and never less, so converting between them loses nothing at all.

Worked example

Convert the colour rgb(255, 99, 71) — tomato — into a HEX code.

Step 1: Red is 255. In hexadecimal, 255 = FF.
Step 2: Green is 99. 99 ÷ 16 = 6 remainder 3, so 99 = 63 in hex.
Step 3: Blue is 71. 71 ÷ 16 = 4 remainder 7, so 71 = 47 in hex.
Step 4: Join the three pairs after a #: #FF6347. Its HSL values are hue 9, saturation 100 percent, lightness 64 percent.

That is exactly what this converter shows for tomato.

FAQ

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

rgb(255, 99, 71) is #FF6347, the colour called tomato. Red 255 becomes FF, green 99 becomes 63, and blue 71 becomes 47 in hexadecimal.

How do I convert RGB to HEX by hand?

Turn each of the three numbers into hexadecimal and write it with two digits, then join them after a #. For example, rgb(0, 128, 255): 0 = 00, 128 = 80, 255 = FF, so the code is #0080FF.

What does the # mean in a HEX colour?

The # at the start simply tells the browser or program that what follows is a hexadecimal colour code. The code works the same without it in many tools, but CSS expects the #.

What is the difference between RGB and HEX?

There is no difference in the colour itself. RGB and HEX are two writings of the same three values: RGB uses decimal numbers (0 to 255), and HEX uses base-16 pairs (00 to FF). Converting between them changes nothing.

How many colours can RGB make?

RGB can make 16,777,216 colours: 256 levels of red times 256 of green times 256 of blue. This is known as 24-bit or true colour.

What is HSL and when should I use it?

HSL describes a colour by hue (its position on the colour wheel, 0 to 360), saturation and lightness in percent. It is handy when you want lighter or darker versions of the same colour, because you only change the lightness.

Which other tools work well with the RGB to HEX Converter?

The Related tools section on this page links the calculators and converters people use most often alongside the RGB to HEX Converter. They are all free, so you can carry your result straight into the next calculation.

Is the RGB to HEX Converter free to use?

Yes. The RGB to HEX Converter is completely free on RupayaTools — no sign-up, no subscription and no usage limit. Just enter your values and your result appears straight away.