Hex to RGB converter

Type or paste a Hex value and get the RGB code instantly, with a copy button. Below: how the conversion works step by step, and a table of common colors.

Convert Hex to RGB

  1. Example: #3B82F6 = rgb(59, 130, 246)

How to convert Hex to RGB

Split the hex code into three pairs of digits and convert each pair from base 16 to a number from 0 to 255. A 3-digit code such as #F80 is shorthand for #FF8800.

  1. Start with the hex code, for example #3B82F6.
  2. Red: 3B = 3 × 16 + 11 = 59.
  3. Green: 82 = 8 × 16 + 2 = 130.
  4. Blue: F6 = 15 × 16 + 6 = 246.
  5. Result: rgb(59, 130, 246).

Hex to RGB table for common colors

ColorHexRGB
Red#FF0000rgb(255, 0, 0)
Orange#FFA500rgb(255, 165, 0)
Yellow#FFFF00rgb(255, 255, 0)
Green#008000rgb(0, 128, 0)
Blue#0000FFrgb(0, 0, 255)
Purple#800080rgb(128, 0, 128)
Pink#FFC0CBrgb(255, 192, 203)
Brown#A52A2Argb(165, 42, 42)
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Gray#808080rgb(128, 128, 128)
Navy#000080rgb(0, 0, 128)
Teal#008080rgb(0, 128, 128)
Gold#FFD700rgb(255, 215, 0)
Sky Blue#87CEEBrgb(135, 206, 235)
Maroon#800000rgb(128, 0, 0)

Hex and RGB tips

  • Hex codes are not case-sensitive: #3b82f6 and #3B82F6 are the same color.
  • A 3-digit code such as #F80 is shorthand for #FF8800; it only works when each pair repeats.
  • An 8-digit code adds transparency: #3B82F680 is the same blue at about 50% opacity.
  • In CSS you can use either form: color: #3B82F6; and color: rgb(59 130 246); are identical.
  • Each channel runs from 0 to 255; rgb(0, 0, 0) is black and rgb(255, 255, 255) is white.
  • Modern CSS also accepts spaces and an alpha value: rgb(59 130 246 / 50%).

What are Hex and RGB?

A hex code is a color written as three pairs of hexadecimal digits, one each for red, green and blue, such as #3B82F6. It is the most common way to write colors in CSS and design tools.

RGB describes a color by how much red, green and blue light it contains, each from 0 to 255, such as rgb(59, 130, 246). Screens build every color from these three lights.

Other color conversions

Frequently asked questions

How do I convert Hex to RGB?

Split the hex code into three pairs of digits and convert each pair from base 16 to a number from 0 to 255. A 3-digit code such as #F80 is shorthand for #FF8800. Or paste the value into the converter above.

What is #3B82F6 in RGB?

#3B82F6 is rgb(59, 130, 246) in RGB.

Is the Hex to RGB conversion exact?

Yes, apart from rounding: both describe the same sRGB color, so converting back gives the same value.

Can I convert other formats?

Yes. The color converter takes any CSS color and gives hex, RGB, HSL, OKLCH, CMYK, Display P3 and code for Tailwind, Swift, Android and Flutter.