HEX to RGB Converter

By: Calculator Grid

HEX to RGB Converter

Convert web colors between hexadecimal notation and RGB channel values, with shorthand support and an exportable calculation record.

#4CAF50rgb(76, 175, 80)6-digit HEX
Example workbook is ready.

Color input

Enter 3 or 6 hexadecimal digits, with or without #.
Each channel must be a whole number from 0 to 255.

Converted color

rgb(76, 175, 80)
Red76
Green175
Blue80
Enter a complete valid color to see the conversion.

Channel breakdown

Channel HEX pair Decimal value Intensity
Red 4C 76 29.80%
Green AF 175 68.63%
Blue 50 80 31.37%
Each two-digit HEX pair is the same channel value written in base 16; the percentage shows that channel's share of its maximum intensity of 255.

How to use this HEX to RGB converter

What this calculator does. This converter translates one sRGB color between hexadecimal notation and decimal RGB notation. It provides an exact identity conversion for 3-digit or 6-digit HEX colors and for integer red, green, and blue channel values from 0 through 255. It does not judge whether a color is attractive, accessible, print-safe, or accurately reproduced on every display.

When to use it. Use it while moving a brand color from a design file into CSS, checking a developer handoff, translating an RGB value from an image editor into a HEX token, or documenting color values in a spreadsheet. The W3C CSS Color specification explains how HEX and RGB syntaxes represent sRGB colors on the web.

How to calculate. The converter opens with the demonstration color #4CAF50, so the result and Excel workbook are immediately available. Follow these steps:

  1. Choose Conversion direction. Select “HEX to RGB” when you have a code such as #4CAF50, or “RGB to HEX” when you have three decimal channel values.
  2. Replace the demonstration value. In HEX color, enter exactly three or six hexadecimal digits, optionally preceded by #. In RGB mode, enter whole numbers in Red, Green, and Blue.
  3. Read Converted color, the color preview, the three channel cards, and the Channel breakdown table. All update live from the same validated model.
  4. Select Download Excel to save the current inputs and outputs as a real .xlsx workbook. Reset clears the demonstration and all calculated content; export remains unavailable until you enter another complete valid color.

Input guide. Conversion direction is required and controls which notation is editable. HEX color is required in HEX mode and accepts #RRGGBB or #RGB using digits 0-9 and letters A-F, for example #09C or #0099CC. Three-digit shorthand repeats each digit, so #09C becomes #0099CC; it never pads with zeros. Red, Green, and Blue are required in RGB mode. Each accepts one base-10 integer from 0 to 255, such as 76, 175, and 80. Decimals, signs, scientific notation, commas, units, and values outside the range are rejected rather than silently changed.

Output guide. Converted color is the exact alternate notation: rgb(R, G, B) in HEX-to-RGB mode or #RRGGBB in RGB-to-HEX mode. Red, Green, and Blue show the decimal channel intensities. A value of 0 means that primary contributes no light; 255 means maximum channel intensity. The summary pills show the normalized six-digit HEX value, the RGB function form, and whether the original valid HEX input used three or six digits. The Channel breakdown table lists each channel, its two-digit HEX pair, decimal value, and percentage of 255. These values are exact conversions; the displayed percentages are rounded to two decimals.

Worked example. For #4CAF50, divide the code into 4C, AF, and 50. Converting those base-16 pairs gives 4C = 76, AF = 175, and 50 = 80, so the first-open result is rgb(76, 175, 80). Reversing the direction converts 76 to 4C, 175 to AF, and 80 to 50, recreating #4CAF50. The MDN HEX color reference gives additional syntax examples, including shorthand and alpha-enabled forms.

How the conversion works

HEX uses base 16, whose digits run from 0 through 9 and then A through F. A two-digit pair has a high-place digit worth sixteen times its value and a low-place digit worth its face value. For example, 4C equals 4 × 16 + 12 = 76. RGB writes the same channel directly in base 10. Because FF in hexadecimal equals 255 in decimal, every channel maps cleanly between 00-FF and 0-255.

The color preview is useful for a quick visual check, but visual similarity is not a substitute for numerical identity. Display calibration, color profiles, ambient light, and browser rendering can all change how a color appears. For accessibility work, compare foreground and background colors using the W3C guidance on minimum text contrast; a valid color code alone does not guarantee readable content.

Common mistakes

  • Confusing #RGB shorthand with zero-padding. #ABC expands to #AABBCC, not #0A0B0C.
  • Entering decimal RGB values in a HEX field. The pair “80” means decimal 128 when interpreted as hexadecimal.
  • Using percentages or decimals for RGB channels when the required format is an integer from 0 to 255.
  • Assuming HEX and RGB are different colors. They are alternate notations for the same sRGB channel values.