Skip to content

Convert HEX to RGB: color code converter

Type or paste a hex code and instantly get its RGB value, ready to copy into CSS, plus HSL, CMYK, LAB and more formats. It also works the other way round.

#
#2C71DErgb(44, 113, 222)

RGB channels

  • Red2C → 44
  • Green71 → 113
  • BlueDE → 222

Or pick the color visually

Color Conversion

HEX to RGB color chart

The most looked-up colors with their hex code and RGB value. Click one to load it into the converter.

ColorHEXRGB
#FFFFFFrgb(255, 255, 255)
#000000rgb(0, 0, 0)
#FF0000rgb(255, 0, 0)
#00FF00rgb(0, 255, 0)
#0000FFrgb(0, 0, 255)
#FFFF00rgb(255, 255, 0)
#00FFFFrgb(0, 255, 255)
#FF00FFrgb(255, 0, 255)
#FFA500rgb(255, 165, 0)
#800080rgb(128, 0, 128)
#FFC0CBrgb(255, 192, 203)
#A52A2Argb(165, 42, 42)
#808080rgb(128, 128, 128)
#C0C0C0rgb(192, 192, 192)
#000080rgb(0, 0, 128)
#808000rgb(128, 128, 0)

How a Hex color converts to RGB

A Hex code has six characters, grouped into three pairs: one for red, one for green and one for blue. Each pair is a base-16 number (hexadecimal, with digits 0–9 and letters A–F) that converts to a base-10 number (decimal, from 0 to 255) to get the RGB value.

For example, the color E65817 breaks down like this:

  • E6230red
  • 5888green
  • 1723blue
rgb(230, 88, 23)

The result is rgb(230, 88, 23). The higher each channel’s value, the more of that color is in the final mix.

  • E6 = 14 × 16 + 6 = 230
  • 58 = 5 × 16 + 8 = 88
  • 17 = 1 × 16 + 7 = 23

The formula, step by step

In hexadecimal, the first position of each pair is worth 16 times the second: multiply the first character by 16 and add the second. Letters are worth A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

HEX and RGB formats CSS accepts

The same color can be written in several ways. All of them work in current browsers, and the converter understands any of them.

  • 6-digit HEX

    The most common format: two characters per channel, in red, green and blue order. Upper or lower case makes no difference.

  • Short HEX (3 digits)

    When each pair repeats its character, it can be shortened: #FF6600 becomes #F60.

  • HEX with transparency (8 digits)

    The last two characters are the alpha channel: 00 is transparent and FF opaque. 80 is about 50%.

  • rgb() with commas

    The classic syntax, supported by every browser. Each channel goes from 0 to 255.

  • Modern rgb()

    The CSS Color 4 syntax: space-separated values and optional transparency after the slash. rgba() still works as an alias.

From Hex to harmonious palettes

Once you have the RGB value, you can build complementary or analogous schemes with the color wheel and fine-tune the shade in the color picker.

FAQ

Each pair of characters in the Hex code represents a channel (red, green and blue) in base 16. Convert each pair to base 10 and you get a number from 0 to 255 for that channel. Together they form the RGB value.

Because it needs two characters for each of the three color channels (red, green and blue), and each base-16 pair can represent 256 distinct values — the same range RGB uses.

The hexadecimal system uses digits 0–9 and letters A–F to represent values from 10 to 15. That is why a Hex code can mix numbers and letters, such as E65817.

Yes. Use the RGB to Hex converter for the reverse process: enter the three RGB values and get the matching hexadecimal code.

A shorthand that works when each pair repeats its character: #F60 equals #FF6600 and #FFF equals #FFFFFF. The converter accepts both.

Add two more characters at the end: the alpha channel. #E6581780 is the same orange at 50% opacity; 00 is fully transparent and FF opaque.

In practice, none today: in modern CSS rgb() also accepts transparency, as in rgb(230 88 23 / 50%), and rgba() is kept as an alias for compatibility.

Related tools