What Is a Hex to RGB Converter?
A hex color code is a six-digit hexadecimal representation of a color, written as #RRGGBB. Each two-digit pair encodes one of the three additive color channels: red, green and blue. This converter reads a hex code and returns the equivalent RGB triplet, where each channel is an integer from 0 to 255. RGB is the format CSS, design software and most screens use under the hood, so converting between the two is a daily task for web developers and designers.
How to Use It
Type a hex code into the box — with or without the leading #. Both the full six-digit form (#3498DB) and the three-digit shorthand (#39C, which expands to #3399CC) are accepted. The tool cleans up any stray characters, normalizes the code, and instantly shows the red, green and blue values along with a live color swatch and ready-to-paste CSS.
The Formula Explained
Hexadecimal is base 16, using the digits 0–9 and letters A–F (where A=10 … F=15). A two-character pair is converted with the rule value = first digit \(\times\) 16 + second digit. So FF = \(15 \times 16 + 15 = 255\), the maximum, and 00 = 0, the minimum. The three pairs are decoded independently into R, G and B.
Worked Example
Take #3498DB. The red pair is 34 = \(3 \times 16 + 4 =\) 52. The green pair is 98 = \(9 \times 16 + 8 =\) 152. The blue pair is DB = \(13 \times 16 + 11 =\) 219. The result is rgb(52, 152, 219) — a popular flat-design blue.
FAQ
Does it accept shorthand hex like #FFF? Yes. A three-digit code is expanded by doubling each digit, so #FFF becomes #FFFFFF = rgb(255, 255, 255).
What about an alpha (transparency) channel? This tool handles the three-channel RGB color. An 8-digit hex with alpha is trimmed to its first six digits for the color conversion.
How do I go from RGB back to hex? Format each channel value as a two-digit hexadecimal number and concatenate them after a #. For example 52, 152, 219 → 34, 98, DB → #3498DB.