HEX to RGB Converter
The HEX to RGB converter reads a CSS-style hex color such as #3366CC and splits it into the red, green, and blue channel values that design tools, canvas code, image scripts, and color documentation often display. Select RGB β HEX in the same form to encode three decimal channel values. Each RGB channel must be a whole number from 0 through 255; fractional channels are rejected rather than rounded.
Hex notation is compact because it writes each 0-to-255 channel as two hexadecimal digits. That is convenient in stylesheets and design tokens, but it hides the channel balance. Converting to RGB makes the color easier to inspect: you can see whether a blue is strong because the blue channel is high, whether a gray is neutral because all channels match, or whether a brand color is warmer because red exceeds blue.
How CSS hex color encoding works
Hexadecimal is base 16. It uses digits 0 through 9 and letters A through F, where A means 10, B means 11, and F means 15. A two-digit hex pair can represent 256 values:
That exactly matches the 0 through 255 range of an 8-bit color channel. A six-digit color has the pattern #RRGGBB: first red, then green, then blue. For #3366CC, the pairs are:
Each pair is converted independently. The converter also accepts three-digit shorthand such as #36C. In CSS shorthand, each digit is doubled, so #36C becomes #3366CC before the channel values are calculated.
For a general base-16 number tool, see the decimal to hexadecimal converter. For binary and byte concepts behind digital values, the binary calculator and digital storage converter are useful companions.
Formula
For a hex pair with first digit a and second digit b, where each digit has a decimal value from 0 to 15:
The full color is read as:
For #3366CC, 3 has decimal value 3, 6 has decimal value 6, and C has decimal value 12:
So the RGB form is rgb(51, 102, 204).
Conversion example using the stated method
Leave the conversion direction set to HEX to RGB and enter the default #3366CC. The calculator trims the leading hash, validates that the remaining value has either three or six hex digits, and normalizes the value to uppercase. The six digits split into 33, 66, and CC.
The decimal conversions are 51, 102, and 204, so the primary result is rgb(51, 102, 204). The result details list Red: 51, Green: 102, Blue: 204, and HEX: #3366CC. The note states that #3366CC uses red 51, green 102, and blue 204 on the 0-255 RGB scale, and the copy text is #3366CC = rgb(51, 102, 204).
If you enter shorthand #36C, the converter expands it to #3366CC and returns the same RGB channels. If you enter a value with non-hex characters, such as #33GGCC, the calculator marks it invalid because G is not a hexadecimal digit.
For the reverse direction, select RGB β HEX and enter whole-number red, green, and blue channels from 0 through 255. The form converts each channel to one two-digit hexadecimal pair without changing or rounding the channel value.
Reference table for reading hex colors
| HEX color | Common name | Red | Green | Blue | RGB notation |
|---|---|---|---|---|---|
#000000 | Black | 0 | 0 | 0 | rgb(0, 0, 0) |
#FFFFFF | White | 255 | 255 | 255 | rgb(255, 255, 255) |
#FF0000 | Red | 255 | 0 | 0 | rgb(255, 0, 0) |
#00FF00 | Lime | 0 | 255 | 0 | rgb(0, 255, 0) |
#0000FF | Blue | 0 | 0 | 255 | rgb(0, 0, 255) |
#808080 | Gray | 128 | 128 | 128 | rgb(128, 128, 128) |
#FA8072 | Salmon | 250 | 128 | 114 | rgb(250, 128, 114) |
#663399 | RebeccaPurple | 102 | 51 | 153 | rgb(102, 51, 153) |
Named colors are included here only as recognizable examples. The converter itself does not look up color names; it decodes numeric hex values.
Interpreting the RGB channels
RGB values describe additive light. Higher channel numbers mean more light from that channel. Equal channel values create grays because red, green, and blue are balanced. When blue is much higher than red and green, the color appears blue or cool. When red and green are high but blue is low, the color moves toward yellow.
This channel view helps when debugging CSS. A color that looks too purple may have too much blue relative to green. A muted color often has channels closer together than a saturated one. Converting from hex to RGB lets you reason about these relationships without mentally decoding base 16.
It also makes handoff conversations clearer. A designer can say that the blue channel is the dominant value, a developer can compare the same numbers in a browser inspector, and a content editor can document the approved RGB notation without changing the original brand color.
Common mistakes
- Reading
#RRGGBBin the wrong order. CSS hex uses red, then green, then blue. - Treating
CCas decimal cc; it is base 16 and equals 204. - Forgetting that
#36Cexpands to#3366CC, not#3060C0. - Including opacity digits such as
#RRGGBBAA; this converter expects three or six hex digits. - Entering RGB percentages in the reverse mode when the calculator expects 0-to-255 channel values.
- Entering fractional RGB channels; reverse mode accepts only whole-number byte values.
- Assuming a color name is accepted; use the actual hex code instead.
Sources
- MDN Web Docs, CSS color value β documents CSS color notations, including hex and RGB forms.
- W3C, CSS Color Module Level 4 β specifies modern CSS color syntax.
- W3C, CSS Color Module Level 3 β defines legacy sRGB color keywords and hex notation behavior.