COLOR CONVERSION GUIDE
HEX to RGB Converter – Convert Hex Color Codes to RGB and RGBA Online Free
Need a quick and accurate HEX to RGB converter? Our free hex to RGB color converter changes any HEX color code, such as #FF5733 or #3B82F6, into red, green and blue values in less than a second, with no signup, no software to install and no limits. Type or paste a hex color code, or use the color picker, and the tool instantly shows the RGB value, the RGBA value with transparency, the percentage and decimal versions, and ready-to-paste code for CSS, Python, JavaScript, Swift, Android and Flutter. It also shows how each hex pair is calculated, which makes it a handy hex to RGB calculator for students and beginners. Need to convert a whole palette? The bulk hex to RGB converter turns hundreds of color codes into a table in one click and exports them as CSV or as a list of rgb() values. Web designers, developers, graphic designers, UI designers and students use it every day to move colors from style guides into code, design tools and documents. Everything runs in your browser, so your colors stay private and results appear while you type, on your phone, tablet or computer.
RGB
HEX to RGB Color Converter
Convert a hex color code to RGB with a live color preview. Enter a 3, 4, 6 or 8 digit hex value with or without the hash sign and instantly get the red, green and blue numbers from 0 to 255, plus a step-by-step breakdown of how each hex pair becomes a decimal value.
A
HEX to RGBA with Transparency
Working with an 8 digit hex code or a 4 digit shorthand? The converter reads the alpha channel and gives you a correct rgba() value with opacity from 0 to 1, so semi-transparent colors from your design file can be pasted straight into CSS, Android or iOS code.
CSV
Bulk HEX to RGB Converter
Convert a full color palette or theme file in one step. Paste up to 500 hex codes, see a clean table with a color swatch and the R, G and B of every color, and copy the result as CSV for spreadsheets or as a list of rgb() values for your stylesheet.
How to Convert HEX to RGB Online (Step by Step)
Converting a hex color code to RGB takes just a few seconds, and you do not need to calculate anything yourself. Follow these simple steps to convert hex to RGB with our free online color converter.
-
Enter your HEX color code: Type or paste a code such as #FF5733 into the HEX field. The hash sign is optional, uppercase and lowercase both work, and short codes like #F53 are expanded automatically.
-
Or pick a color visually: Click the color picker beside the input to choose any color and see its HEX and RGB values right away.
-
Read the RGB result: The red, green and blue cards show the value of each channel from 0 to 255, with a small bar and the math behind each hex pair.
-
Copy the format you need: Copy plain RGB values, the CSS rgb() or rgba() function, percentages, decimal values, or code for Python, JavaScript, Swift, Android and Flutter.
-
Convert many colors at once: Scroll to the bulk converter, paste your list of hex codes and click Convert all.
The converter works inside your browser, so there is no upload and no waiting time. If you type an invalid code, the field turns red and a short message explains what to fix.
What Are HEX and RGB Color Codes?
RGB is the color model used by every screen, from phones and laptops to TVs and monitors. A color is made by mixing red, green and blue light, and each of the three channels gets a number from 0 (none of that light) to 255 (full brightness). With 256 possible values per channel, RGB can describe 256 × 256 × 256 = 16,777,216 different colors, which is why it is called 24-bit or true color.
A HEX color code is simply the same RGB color written in hexadecimal, which is a base 16 number system. Instead of three decimal numbers, a hex code uses six characters made from the digits 0 to 9 and the letters A to F, placed after a hash sign. The first two characters are red, the middle two are green and the last two are blue. So #FF5733 is red FF, green 57 and blue 33. Hex codes are popular in web design, CSS, HTML and brand guidelines because they are short and easy to copy, while RGB values are common in design software, programming languages and image processing.
How HEX to RGB Conversion Works (Worked Examples)
To convert HEX to RGB, split the six characters into three pairs and change each pair from base 16 to a normal decimal number. For each pair, multiply the first digit by 16 and add the second digit. Remember that the letters A to F stand for 10 to 15.
Hexadecimal digit values
| Hex digit |
0 to 9 |
A |
B |
C |
D |
E |
F |
| Decimal value |
0 to 9 |
10 |
11 |
12 |
13 |
14 |
15 |
Example 1: #FF5733. Red is FF, which is 15 × 16 + 15 = 255. Green is 57, which is 5 × 16 + 7 = 87. Blue is 33, which is 3 × 16 + 3 = 51. The result is rgb(255, 87, 51).
Example 2: #3B82F6. Red is 3B, which is 3 × 16 + 11 = 59. Green is 82, which is 8 × 16 + 2 = 130. Blue is F6, which is 15 × 16 + 6 = 246. The result is rgb(59, 130, 246).
The smallest possible pair is 00, which equals 0, and the largest is FF, which equals 255. That is why #000000 is black, with all channels at 0, and #FFFFFF is white, with all channels at 255. When the red, green and blue values are the same, the color is a shade of gray, such as #808080, which is rgb(128, 128, 128).
HEX vs RGB vs RGBA vs HSL: Which Color Format Should You Use?
All of these formats can describe the same colors, but each one is more convenient in certain situations. This comparison shows when to use which.
HEX vs RGB vs RGBA vs HSL
| Feature |
HEX |
RGB |
RGBA |
HSL |
| Example |
#3B82F6 |
rgb(59, 130, 246) |
rgba(59, 130, 246, 0.5) |
hsl(217, 91%, 60%) |
| Number system |
Base 16 |
Base 10 |
Base 10 plus alpha |
Degrees and percent |
| Supports transparency |
Only with 8 digits |
Modern CSS only |
Yes |
With hsla() or modern CSS |
| Easy to read and tweak |
Short, but hard to edit by eye |
Clear channel values |
Clear channel values |
Easiest for lightness changes |
| Best for |
CSS, brand guides, sharing |
Code, design tools, image data |
Overlays, shadows, glass effects |
Themes and design systems |
In short: use HEX when you want a compact color code for sharing and styling, use RGB when you need the individual channel numbers for code or image work, and use RGBA when the color needs transparency.
Common HEX to RGB Conversions (Quick Reference Chart)
Here is a HEX to RGB chart for popular colors. Use it as a quick check or as a starting point for your own design.
HEX to RGB chart for common colors
| Color |
HEX |
RGB |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green (lime) | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Cyan | #00FFFF | rgb(0, 255, 255) |
| Magenta | #FF00FF | rgb(255, 0, 255) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Gray | #808080 | rgb(128, 128, 128) |
| Black | #000000 | rgb(0, 0, 0) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Orange red | #FF5733 | rgb(255, 87, 51) |
| Royal blue | #3B82F6 | rgb(59, 130, 246) |
| Emerald green | #10B981 | rgb(16, 185, 129) |
Use HEX to RGBA in CSS: 8-Digit HEX and Transparency
An 8 digit hex code adds two characters at the end for alpha, which controls opacity. The alpha pair works exactly like the color pairs: 00 means fully transparent and FF means fully opaque. To get the CSS opacity, divide the alpha value by 255. For example, #3B82F680 has an alpha of 80 in hex, which is 128 in decimal, or about 0.5 opacity, so it becomes rgba(59, 130, 246, 0.5). The converter does this calculation for you and shows the RGBA row whenever your code includes alpha.
HEX alpha values and opacity
| Opacity |
100% |
90% |
80% |
70% |
60% |
50% |
40% |
30% |
20% |
10% |
0% |
| HEX alpha |
FF | E6 | CC | B3 | 99 | 80 | 66 | 4D | 33 | 1A | 00 |
Modern CSS also lets you write rgb() with a slash for alpha, for example rgb(59 130 246 / 50%). The converter provides this space-separated syntax in its own row, as well as the classic comma-separated rgb() and rgba() versions that work in every browser.
HEX to RGB for Developers: JavaScript, Python, PHP, Swift, Android and Flutter
Programmers often need to convert a hex code to RGB inside their own code, for charts, canvas drawing, image processing, themes or generated styles. Here are short examples for three popular languages, and the result panel also gives you copy-ready lines for Swift, Android and Flutter.
// JavaScript: HEX to RGB
function hexToRgb(hex) {
const n = parseInt(hex.replace("#", ""), 16);
return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
}
hexToRgb("#FF5733"); // [255, 87, 51]
# Python: HEX to RGB
hex_code = "FF5733"
r, g, b = (int(hex_code[i:i+2], 16) for i in (0, 2, 4))
print(r, g, b) # 255 87 51
// PHP: HEX to RGB
list($r, $g, $b) = sscanf("#FF5733", "#%02x%02x%02x");
echo "rgb($r, $g, $b)"; // rgb(255, 87, 51)
Platform formats for the color #3B82F6
| Platform |
Code |
Value range |
| CSS | rgb(59, 130, 246) | 0 to 255 |
| Swift (UIColor) | UIColor(red: 0.231, green: 0.510, blue: 0.965, alpha: 1.0) | 0.0 to 1.0 |
| Android (Kotlin) | Color.rgb(59, 130, 246) | 0 to 255 |
| Flutter | Color(0xFF3B82F6) | 0xAARRGGBB |
| Python tuple | (59, 130, 246) | 0 to 255 |
Notice that Swift uses decimal values between 0 and 1, while Android and CSS use whole numbers up to 255, and Flutter puts the alpha first in its hex format. Picking the right row in the converter helps you avoid these small but common mistakes.
HEX to RGB for Designers: Figma, Photoshop, Illustrator and Canva
Design tools usually let you enter colors in more than one format, but brand guidelines and developers often hand you a HEX code only. Converting the hex code to RGB lets you enter the exact color in tools that ask for separate red, green and blue fields, document the color for a team, or compare it with values from a screenshot or an image editor. It is also useful when you need to explain a color to someone in plain numbers.
- Match a brand color exactly: Convert the brand hex to RGB and type the values into any color picker.
- Prepare screen designs: RGB is the native color mode of screens, so it is the right format for websites, apps and social media graphics.
- Build overlays and shadows: Use the RGBA row to create semi-transparent layers with the same base color.
- Create style guide tables: Use the bulk converter to list every color with its HEX and RGB side by side.
RGB is made for screens. If you are preparing artwork for print, the colors will later be converted to CMYK, and the result can look slightly different on paper than on your display, so always check a print proof for color-critical work.
Short HEX Codes and Shorthand: How 3-Digit and 4-Digit HEX Convert to RGB
A 3 digit hex code is a shortcut for a 6 digit code in which every digit is doubled. For example, #F53 stands for #FF5533, which is rgb(255, 85, 51). Likewise a 4 digit code such as #F538 stands for #FF553388 and includes an alpha value. Shorthand only works when each pair has two identical digits, so a color like #3B82F6 cannot be shortened. The converter expands short codes automatically and shows you the full normalized HEX so you can see exactly what was calculated.
- #FFF becomes #FFFFFF, which is rgb(255, 255, 255).
- #000 becomes #000000, which is rgb(0, 0, 0).
- #0AF becomes #00AAFF, which is rgb(0, 170, 255).
- #F008 becomes #FF000088, which is red with about 53% opacity.
Bulk Convert HEX Color Codes to RGB (CSV and CSS Export)
When you work with a full theme, a design system or a long color list, converting one code at a time wastes hours. The bulk HEX to RGB converter accepts up to 500 codes separated by new lines, spaces or commas and builds a table with a color swatch, the normalized HEX and the R, G and B values. Invalid entries are flagged so you can fix them quickly. Press Copy as CSV to paste the table into Excel or Google Sheets, or press Copy as rgb() to get one ready-to-use rgb() line per color for your stylesheet or code.
- Design systems and style guides: Document every color with HEX and RGB values.
- Theme and palette files: Convert color lists from CSS, SCSS or JSON in one step.
- Data visualization: Prepare chart colors in the RGB format your library expects.
- Homework and teaching: Check many conversions at once while learning number systems.
Tips for Accurate HEX to RGB Conversion
A few small details can decide whether a conversion works or not. Keep these tips in mind whenever you convert a hex color code to RGB.
- Hex is not case sensitive: #ff5733 and #FF5733 are the same color.
- Use only valid characters: A hex code may contain only the digits 0 to 9 and the letters A to F. Letters such as G, O or Z make the code invalid.
- Watch out for O and 0: The letter O and the number zero look alike, and mixing them up is one of the most common typing mistakes.
- Count the digits: Valid lengths are 3, 4, 6 or 8 digits after the hash sign. A code with 5 or 7 digits is incomplete.
- Remember the alpha position: In CSS the alpha comes last (RRGGBBAA), but Android and Flutter integer colors put it first (AARRGGBB).
- Pick the right value range: Some platforms use 0 to 255, others use 0 to 1 or percentages. Choose the matching row in the result panel.
HEX to RGB Converter for Any Device, No Software Needed
Our online HEX to RGB color converter works in your web browser on Windows, Mac, Linux, Android and iPhone, so there is nothing to download or install. Whether you are searching for a hex to RGB converter for CSS, a hex to RGBA converter for transparent colors, a hex to RGB calculator for homework or a hex to RGB chart to keep handy, the process is the same: enter the color and copy the result. There is no account, no trial and no limit on how many colors you convert.
Because the conversion is calculated on your device, results show up instantly while you type, and your colors never leave your browser.
Hexadecimal to Decimal Chart for Color Codes
Each pair in a HEX color is one number from 0 to 255. The first character counts groups of 16 and the second counts single units, with the letters A to F standing for 10 to 15.
HEX to decimal conversion chart
| HEX pair | Decimal value | HEX pair | Decimal value |
| 00 | 0 | 80 | 128 |
| 0A | 10 | 99 | 153 |
| 10 | 16 | AA | 170 |
| 1A | 26 | C0 | 192 |
| 33 | 51 | CC | 204 |
| 40 | 64 | E6 | 230 |
| 66 | 102 | F0 | 240 |
| 7F | 127 | FF | 255 |
HEX Alpha Values: Opacity Percentage Chart
In an 8 digit CSS HEX code, the last pair controls transparency. FF is fully opaque and 00 is fully transparent. Use this chart to add opacity to any 6 digit color.
CSS HEX opacity chart
| Opacity | Alpha pair | Example on #FF5733 |
| 100% | FF | #FF5733FF |
| 90% | E6 | #FF5733E6 |
| 80% | CC | #FF5733CC |
| 75% | BF | #FF5733BF |
| 60% | 99 | #FF573399 |
| 50% | 80 | #FF573380 |
| 40% | 66 | #FF573366 |
| 25% | 40 | #FF573340 |
| 10% | 1A | #FF57331A |
| 0% | 00 | #FF573300 |
Modern CSS rgb() Syntax vs Legacy rgba()
The comma style rgb(255, 87, 51) and rgba(255, 87, 51, 0.5) is widely recognized. Current CSS also accepts the space separated style with a slash before alpha, as in rgb(255 87 51 / 50%). In current CSS, rgb() and rgba() work as aliases. Choose one style for your codebase, and check your build tools or email templates before changing older code, since some software only understands the comma form.
Why Your RGB Values May Not Match a Screenshot
If you sample a color from a screenshot and get numbers that differ slightly from the brand guide, the converter is usually not the cause. Image compression, color profiles, transparency over another layer, gradients and display settings can all change the pixel you pick. Take the official HEX code from the brand source when possible. For an exact HEX code, the HEX to RGB step involves no rounding, because each pair maps to one whole number.
RGB to HEX: Converting Back the Other Way
To reverse the process, convert each RGB number to base 16 and keep two characters for each channel. Divide the number by 16: the whole result gives the first digit and the remainder gives the second. For 87, the result is 5 with a remainder of 7, so the pair is 57. A value below 16 needs a leading zero, so 10 becomes 0A. In JavaScript, n.toString(16).padStart(2, '0') does this for one channel. For live two way editing, use the Color Converter.
Free HEX to RGB Color Converter: Fast, Accurate and Private
Our free HEX to RGB converter was built to give web designers, developers, students and creators the quickest way to switch between color formats. Enter any hex color code, see the exact red, green and blue values, copy the format your project needs and get back to work. It is accurate, simple to use and free forever, with a bulk mode when you have many colors to convert.
Ready to try it? Scroll back up, enter your HEX code and get the RGB values in an instant. If you also need other color conversions, explore the other free color tools on our site.