HEX to RGB Converter
You have a hex code, from a design document, screen shot, or style guide, but the tool you're working in only takes RGB.
The conversion between the two is not difficult, if you understand the pattern; and you do not have to perform the calculations by hand. Get a HEX-to-RGB conversion instantly, with just a single inputted HEX code.
HEX Conversion
What's the Difference Between HEX and RGB?
They are not two colors, they are two different ways of writing down this one exact same color.
Hex is a 6 digit code written in hexadecimal (base-16) notation:
#RRGGBB, where each digit is a hex digit from 0 to F. It's a common format in HTML,
CSS, and most design programs since it is short and simple to copy and paste.
RGB is composed of red, green and blue, all of which are a number between 0 and
255, such as rgb(255, 87, 51). It is the format that most programming languages,
canvas APIs and photo editing tools expect when you need to work with the colors channel by
channel.
Both formats are equally "accurate". They do not change the value of the red, green and blue light, just like HEX does not wrap the values in pairs of hexadecimals, but rather in plain decimal format.
Convert HEX to RGB β the Formula.
HEX codes can be divided into three sets of two-digit numbers β one for each color channel:
#RRGGBB
ββ ββ ββ
R G B
To convert manually:
- Divide the hex code into three groups of two hex digits. For
#3E6EF7, that's 3E, 6E, and F7. - Change each pair to decimal. Each pair is from 00 (0 decimal) to FF (255 decimal).
- Read the three results: Red, Green, Blue.
Worked Example
Converting #3E6EF7:
| Hex pair | Decimal value | Channel |
|---|---|---|
| 3E | 62 | Red |
| 6E | 110 | Green |
| F7 | 247 | Blue |
Result: rgb(62, 110, 247)
A quick example of using pure colors.
#FF0000=rgb(255, 0, 0)β pure red#00FF00=rgb(0, 255, 0)β pure green#0000FF=rgb(0, 0, 255)β pure blue#FFFFFF=rgb(255, 255, 255)β white#000000=rgb(0, 0, 0)β black#808080=rgb(128, 128, 128)β mid gray
Every pair of hex has a maximum of FF, which is equal to 255 in decimal β that's why 255 is the maximum value for each RGB channel.
Shorthand HEX Codes
Occasionally you will see a three character hex code such as #3EF. Shorthand:
#3EF becomes #33EEFF before being converted. #3EF
translates to rgb(51, 238, 255) and not from the three characters themselves.
What About HEX with transparency (HEX8 / RGBA)?
An 8 character hex code such as #3E6EF7CC contains a fourth pair (alpha β opacity)
which works the same (hex pair to decimal), but is represented as a fraction of 0 to 1 instead
of 0 to 255. CC in hex is 204 in decimal, and 204 Γ· 255 β 0.8, so #3E6EF7CC becomes
rgba(62, 110, 247, 0.8).
You might need to convert HEX to RGB because:
- Tools for designing in CSS only, that present only that format. Some plugins/older codebases require RGB, not hex.
- Programmatic color manipulation. RGB channels are used directly by many APIs for Canvas, image-processing libraries, and many programming languages, because it is simpler to blend, lighten or darken a color by modifying three numbers.
- Matching colors between software programs. The photo-editing, video and some design applications come with RGB sliders instead of a hex input field.
- Adding transparency. When creating RGBA values for semi-transparent overlays, it is better to begin with the RGB value(s) instead of the hex code.
Frequently Asked Questions
Without a calculator, how to convert HEX to RGB?
Is RGB more accurate than HEX?
What is the meaning of a 3-digit hex code?
How to convert HEX to RGBA with transparency?
Why aren't all tools the same RGB value for an
identical HEX code?
Final Thoughts
HEX and RGB are two ways of indicating the same color data so there is no gain or loss of color information in making the conversion from one to the other. Whether it's a brand color that only accepts RGB values to be pasted into code or an RGBA value to be used for a transparent overlay, it only takes seconds to understand the pattern: split, convert each pair, read off red, green, and blue.
Related Tools You Might Like
Gemini Watermark Remover
Erase watermarks from images locally.
Keyword Wrapper
Wrap keywords for Google Ads PPC match types.
Password Generator
Generate highly secure passwords.
QR Code Generator
Create QR codes for links, Wi-Fi, and cards.
Lorem Ipsum Generator
Generate custom text placeholder paragraphs.
UUID Generator
Generate unique UUID v1 & v4 values.
Browser Extension
Get quick access to remove the gemini watermark from the image and video directly from your browser toolbar.