Pick & Convert

HEX to RGB Converter

Type a HEX color code to get its red, green and blue values, each from 0 to 255. For example, #4169E1 is rgb(65, 105, 225).

RGB  

Your colors and images stay in your browser. Nothing is uploaded or stored on our servers.

How to use the HEX to RGB Converter

  1. Enter a 3- or 6-digit HEX code in the field. The leading # is optional.
  2. The RGB value appears at the top in CSS form, such as rgb(65, 105, 225).
  3. Press Copy RGB, or copy any other format from the table below.
  4. Check the preview swatch and the closest named color to confirm you entered the code you meant.

Examples

Splitting a code

#4169E1 is three pairs of digits: 41, 69 and E1. Read as base-16 numbers they are 65, 105 and 225, so the color is rgb(65, 105, 225).

Short codes

A 3-digit code doubles each digit, so #F60 is #FF6600, which is rgb(255, 102, 0), a strong orange.

Why you may need it

CSS accepts both forms, but canvas code, design tools and many APIs ask for separate red, green and blue numbers.

Tips

  • Uppercase and lowercase HEX are the same color: #4169e1 equals #4169E1.
  • Need the other direction? The RGB to HEX converter does the reverse.

Questions about the HEX to RGB Converter

How do I convert HEX to RGB by hand?

Split the code into three pairs and convert each pair from base 16 to base 10. The first pair is red, the second green and the third blue. In #4169E1, 41 is 65, 69 is 105 and E1 is 225.

Does the # symbol matter?

No. The converter reads 4169E1 and #4169E1 in the same way.

Can I enter 8-digit HEX codes with transparency?

This tool reads 3- and 6-digit codes. For transparency, convert the color here and add the alpha value yourself in rgba(), for example rgba(65, 105, 225, 0.5).

Is HEX or RGB better in CSS?

They are identical for opaque colors, so use whichever you find easier to read. HEX is shorter. rgb() is handier when you want to change one channel or add transparency.

Want the background? Read HEX Color Codes Explained.