My Color Palette Generator

HEX to RGB Converter

To convert HEX to RGB, split the six-digit code into three pairs and convert each pair from base 16 to a number from 0 to 255. For example, #FF5733 is FF = 255, 57 = 87 and 33 = 51, so it becomes rgb(255, 87, 51). Type any HEX or RGB value above to convert it instantly.

HEX to RGB

RGB
HSL
RGBA (8-digit HEX)

RGB to HEX

HEX
HSL

Last updated:

How HEX to RGB works

  1. Split the code into pairs. Remove the # and split the six digits into three pairs: red, green and blue. #FF5733 gives FF, 57 and 33.
  2. Convert each pair to decimal. Multiply the first digit by 16 and add the second (A=10 … F=15). FF = 15×16 + 15 = 255; 57 = 5×16 + 7 = 87; 33 = 3×16 + 3 = 51.
  3. Write the RGB value. Put the three numbers in order: rgb(255, 87, 51).

RGB to HEX

Reverse the steps: divide each RGB number by 16. The whole number is the first hex digit and the remainder is the second (10–15 become A–F). For rgb(255, 87, 51): 255 ÷ 16 = 15 remainder 15 → FF; 87 ÷ 16 = 5 remainder 7 → 57; 51 ÷ 16 = 3 remainder 3 → 33. Join them with a #: #FF5733.

Common colors: HEX and RGB

The 16 basic CSS color keywords:

ColorHEXRGB
black#000000rgb(0, 0, 0)
silver#C0C0C0rgb(192, 192, 192)
gray#808080rgb(128, 128, 128)
white#FFFFFFrgb(255, 255, 255)
maroon#800000rgb(128, 0, 0)
red#FF0000rgb(255, 0, 0)
purple#800080rgb(128, 0, 128)
fuchsia#FF00FFrgb(255, 0, 255)
green#008000rgb(0, 128, 0)
lime#00FF00rgb(0, 255, 0)
olive#808000rgb(128, 128, 0)
yellow#FFFF00rgb(255, 255, 0)
navy#000080rgb(0, 0, 128)
blue#0000FFrgb(0, 0, 255)
teal#008080rgb(0, 128, 128)
aqua#00FFFFrgb(0, 255, 255)

Frequently asked questions

What does #FFFFFF mean?

#FFFFFF is white: red, green and blue are all FF, which is 255, the maximum. #000000 is black, with all three channels at 0.

How do I convert a 3-digit HEX code?

Double each digit first: #F53 → #FF5533. Then convert as usual: FF = 255, 55 = 85, 33 = 51, so #F53 is rgb(255, 85, 51).

What is the difference between HEX and RGB?

Nothing in the color itself. Both describe the same red, green and blue amounts from 0 to 255; HEX writes them in base 16 (#FF5733) and RGB in base 10 (rgb(255, 87, 51)). CSS accepts both.

Can HEX include transparency?

Yes. An 8-digit code #RRGGBBAA adds an alpha pair: 00 is fully transparent and FF fully opaque. #FF573380 is #FF5733 at about 50% opacity, or rgba(255, 87, 51, 0.5).

Related tools