Connect via MCP →

Enter Calculation

Enter a 3- or 6-digit hex code, with or without the leading #.

Formula

Advertisement

Results

RGB Color
rgb(52, 152, 219)
from #3498DB
Red (R) 52
Green (G) 152
Blue (B) 219

What is a HEX to RGB Converter?

A HEX to RGB converter translates a hexadecimal color code (the six-character notation used in CSS, HTML and design tools) into its equivalent RGB values. RGB describes a color as three channels — red, green and blue — each ranging from 0 to 255. A hex code packs those same three values into a compact base-16 string such as #3498DB.

How to Use It

Type any hex color code into the field. You can include or omit the leading #, and you may use the 3-digit shorthand (e.g. #0AF) which is automatically expanded to its 6-digit form (#00AAFF). Press calculate to see the RGB triplet, a color swatch, and each channel value broken out individually.

The Formula Explained

A 6-digit hex code is split into three pairs: characters 1–2 are red, 3–4 are green, and 5–6 are blue. Each pair is a base-16 (hexadecimal) number that is converted to base-10 (decimal). For example, the pair FF equals \(15\times16 + 15 = 255\), the maximum intensity, while 00 equals 0.

$$(R,\,G,\,B) = \left( \text{hex}_{1\text{-}2},\ \text{hex}_{3\text{-}4},\ \text{hex}_{5\text{-}6} \right)_{16}$$$$\text{where}\quad \left\{ \begin{aligned} R &= \big(\,\text{HEX}\,[1\text{-}2]\,\big)_{16} \\ G &= \big(\,\text{HEX}\,[3\text{-}4]\,\big)_{16} \\ B &= \big(\,\text{HEX}\,[5\text{-}6]\,\big)_{16} \end{aligned} \right.$$
Diagram showing a six-digit hex code split into three pairs mapping to red, green, and blue channels
A 6-digit hex code splits into three pairs, each converted to a 0-255 value for R, G, and B.

Worked Example

Take #3498DB. Red = 34 = \(3\times16 + 4 = 52\). Green = 98 = \(9\times16 + 8 = 152\). Blue = DB = \(13\times16 + 11 = 219\). The result is rgb(52, 152, 219) — a pleasant medium blue.

Hex value FF8800 converting to RGB 255, 136, 0 with a color swatch
Example: #FF8800 converts to RGB (255, 136, 0), an orange swatch.

FAQ

Do I need the # symbol? No. The converter strips it automatically, so 3498db and #3498DB give the same result.

Is hex case-sensitive? No. ff and FF are identical; the tool normalizes everything to uppercase.

What about 3-digit codes? Shorthand like #F00 is expanded by doubling each digit to #FF0000, which equals rgb(255, 0, 0) (pure red).

Last updated: