HEX to RGB
Runs locally
Type or paste a HEX color such as #336699 and get its RGB values straight away, ready to copy as rgb(51, 102, 153). Short codes like #369 and codes with transparency like #33669980 work too.
- Free to use
- No registration
- Runs locally in your browser
- Your data is never uploaded
rgb(51, 102, 153)#336699hsl(210, 50%, 40%)hsv(210, 67%, 60%)Contrast (WCAG)
White text: 6.00:1
AA pass · AAA fail · AA large text pass
Black text: 3.50:1
AA fail · AAA fail · AA large text pass
Tints and shades
Palettes
Click a swatch to copy its HEX value.
Your data is processed locally in your browser and is not uploaded.
Learn more about this tool⌄
How it works
A HEX code is three pairs of hexadecimal digits: red, green and blue. Each pair is a number from 00 to FF, which is 0 to 255 in decimal. So #336699 is red 0x33 = 51, green 0x66 = 102, blue 0x99 = 153. A three-digit code doubles each digit (#369 is #336699), and an optional fourth pair is the alpha channel, giving rgba().
Common use cases
- Turning a color from a design file into an rgb() value for CSS
- Getting RGB numbers for software that does not accept HEX
- Adding transparency to a HEX color by converting it to rgba()
Frequently asked questions
- How do I convert HEX to RGB by hand?
- Split the code into three pairs and convert each from hexadecimal to decimal. For #FF8800: FF = 255, 88 = 136, 00 = 0, so rgb(255, 136, 0).
- Does the # matter?
- No. Codes are accepted with or without it.
- What is an 8-digit HEX code?
- The last two digits are the alpha (opacity) value. #33669980 is the color #336699 at about 50% opacity, or rgba(51, 102, 153, 0.5).