Enter a HEX color below to get the exact RGB value instantly, plus every other format, right in your browser.
When you need HEX to RGB
A brand guide, a Figma inspector or a screenshot eyedropper usually hands you a six-digit HEX code. Many programming interfaces, however, want three separate numbers: Android's Color.rgb(), Pillow image tuples and WebGL shader uniforms all work with individual channels. Converting HEX to RGB is also the first step toward transparency, because rgb(255 87 51 / 50%) is easier to edit by hand than an eight-digit hex. Paste the code, copy the three channel values and drop them into your project.
Typical uses
- Passing a brand color to Android Color.rgb() or a Pillow tuple, which take separate 0-255 channel values.
- Preparing colors for WebGL shaders, where each converted channel is divided by 255 to give 0-1 values.
- Writing a translucent CSS overlay as rgb(0 0 0 / 40%), starting from a HEX value in the design spec.
How to convert HEX to RGB
A HEX color code is the same RGB color written in hexadecimal (base-16). The six characters after the # sign form three pairs (RR, GG and BB), one pair per channel.
To convert HEX to RGB, translate each pair from base-16 to decimal: FF equals 255, 57 equals 87, 33 equals 51. To convert RGB to HEX, write each channel value (0-255) as a two-digit hexadecimal number.
Worked example
- R: FF₁₆ = 15 × 16 + 15 = 255
- G: 57₁₆ = 5 × 16 + 7 = 87
- B: 33₁₆ = 3 × 16 + 3 = 51
#FF5733 = rgb(255, 87, 51)
Tip: If a shader or SwiftUI initializer asks for values between 0 and 1, do not retype the HEX. Divide each converted channel by 255 instead: 255 becomes 1.0 and 87 becomes about 0.341. Three decimal places are normally enough.
Common colors: HEX to RGB
| Color | HEX | RGB |
|---|---|---|
| Red | #FF0000 | rgb(255, 0, 0) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Lime | #00FF00 | rgb(0, 255, 0) |
| Green | #008000 | rgb(0, 128, 0) |
| Cyan | #00FFFF | rgb(0, 255, 255) |
| Teal | #008080 | rgb(0, 128, 128) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Navy | #000080 | rgb(0, 0, 128) |
| Purple | #800080 | rgb(128, 0, 128) |
| Magenta | #FF00FF | rgb(255, 0, 255) |
| Pink | #FFC0CB | rgb(255, 192, 203) |
| Brown | #A52A2A | rgb(165, 42, 42) |
| Gray | #808080 | rgb(128, 128, 128) |
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
Frequently asked questions
What if an API wants the color as one integer instead of three channels?
Many libraries, including game engines and Python tools, accept a single packed number. Then you can skip conversion: replace # with 0x, so #ff5733 becomes 0xFF5733. Check the documentation for RGB or ARGB order, otherwise an alpha byte may land in the wrong place.
How do I turn the result into a translucent color?
Keep the three numbers and add an alpha after a slash: rgb(255 87 51 / 50%). The older comma syntax needs rgba(255, 87, 51, 0.5). Modern browsers also accept an eight-digit HEX, but the rgb() form is easier to edit by hand.
Are HEX and RGB the same color model?
Yes, a HEX code is just a compact notation for the same red, green and blue channels. #FF5733 and rgb(255, 87, 51) describe exactly the same color, so the conversion is lossless in both directions.
What do the six characters in a HEX code mean?
They are three two-digit hexadecimal numbers: the first pair is red, the second green, the third blue. Each pair ranges from 00 (0) to FF (255). Three-digit shorthand like #F53 expands by doubling each digit (#FF5533).
Does HEX support transparency?
Yes, an eight-digit code #RRGGBBAA adds an alpha pair, where 00 is fully transparent and FF is fully opaque. In CSS you can also use the rgba() notation, e.g. rgba(255, 87, 51, 0.5).
More color converters
Need to grab a color from an image or screenshot? Try the free Pixel Color Picker →