ES EN FR PT DE IT

Hex to RGB Converter

Convert a hex color to RGB values.

The Hex to RGB Converter is a free utility calculator. Convert a hex color to RGB values. A practical tool for everyday calculations, education, and productivity.
Inputs
Result
Enter values and press Calculate

What is Hex to RGB Conversion?

Hex to RGB conversion transforms a six-digit hexadecimal color code into three decimal values representing red, green, and blue intensity levels. When a web designer specifies #FF5733 in CSS, browsers need the RGB equivalent rgb(255, 87, 51) to render that burnt orange color on screen.

Hexadecimal color codes use base-16 notation where each pair of characters represents one color channel. The first two digits control red intensity, the middle two control green, and the final two control blue. Each channel ranges from 00 (zero intensity) to FF (maximum intensity of 255 in decimal).

This conversion matters for accessibility audits, print preparation, and cross-platform color matching. A designer might receive a brand color as #2E86AB from a logo file but need RGB values of rgb(46, 134, 171) for video editing software that doesn't accept hex input.

Hex to RGB Formulas with Worked Calculations

The conversion formula splits the six-digit hex code into three two-digit pairs and converts each from base-16 to base-10:

R = (Hex₁ × 16) + Hex₂

G = (Hex₃ × 16) + Hex₄

B = (Hex₅ × 16) + Hex₆

Where Hex₁ through Hex₆ represent the decimal values of each hexadecimal digit (0-9 = 0-9, A-F = 10-15).

Worked example: Convert #4A7C9E to RGB.

Red channel: 4A → (4 × 16) + 10 = 64 + 10 = 74

Green channel: 7C → (7 × 16) + 12 = 112 + 12 = 124

Blue channel: 9E → (9 × 16) + 14 = 144 + 14 = 158

Result: rgb(74, 124, 158) — a steel blue color.

For shorthand three-digit hex codes like #3A7, each digit doubles: #33AA77 converts to rgb(51, 170, 119).

How to Convert Hex to RGB: 6 Steps

  1. Remove the hash symbol: Strip the leading # from #C05640 to get C05640. Some calculators accept both formats, but the hash isn't part of the actual hex value.
  2. Split into three pairs: Divide C05640 into C0 (red), 56 (green), and 40 (blue). Each pair controls one color channel.
  3. Convert first pair to decimal: C = 12, 0 = 0, so (12 × 16) + 0 = 192. This is your red value.
  4. Convert second pair to decimal: 5 = 5, 6 = 6, so (5 × 16) + 6 = 86. This is your green value.
  5. Convert third pair to decimal: 4 = 4, 0 = 0, so (4 × 16) + 0 = 64. This is your blue value.
  6. Format as RGB: Combine the three values: rgb(192, 86, 64). This terracotta color can now be used in software requiring RGB input.

5 Hex to RGB Conversion Examples

Example 1 — Brand color conversion: A company logo uses #003366. Red: 00 = 0. Green: 33 = (3 × 16) + 3 = 51. Blue: 66 = (6 × 16) + 6 = 102. Result: rgb(0, 51, 102) — a deep navy blue commonly used in corporate branding.

Example 2 — Pure color values: #FF0000 represents pure red. Red: FF = (15 × 16) + 15 = 255. Green: 00 = 0. Blue: 00 = 0. Result: rgb(255, 0, 0). Similarly, #00FF00 = rgb(0, 255, 0) (pure green) and #0000FF = rgb(0, 0, 255) (pure blue).

Example 3 — Grayscale conversion: #808080 is medium gray. All three pairs equal 80 = (8 × 16) + 0 = 128. Result: rgb(128, 128, 128). Any hex code where all six digits match produces a grayscale RGB value.

Example 4 — Shorthand notation: #1AC expands to #11AACC. Red: 11 = 17. Green: AA = 170. Blue: CC = 204. Result: rgb(17, 170, 204) — a bright cyan. Shorthand only works when each pair contains identical digits.

Example 5 — Web-safe color: #33CC99 converts to red: 51, green: 204, blue: 153. Result: rgb(51, 204, 153) — a mint green that displays consistently across older monitors with 256-color limitations.

4 Common Hex to RGB Mistakes

  • Treating hex as decimal: Reading #191919 as nineteen instead of (1 × 16) + 9 = 25 produces rgb(19, 19, 19) instead of the correct rgb(25, 25, 25). Always multiply the first digit by 16 before adding the second.
  • Forgetting A-F values: Assuming #ABCDEF contains invalid numbers. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. This gradient hex converts to rgb(171, 205, 239) — a light blue.
  • Mixing up channel order: Assigning the first pair to blue instead of red. #FF8800 is orange (red 255, green 136, blue 0), not blue-dominant. RGB order is fixed: red first, green second, blue third.
  • Incorrect shorthand expansion: Expanding #F4A to #FF44AA instead of #FF44AA. Each digit doubles: F→FF, 4→44, A→AA. The result rgb(255, 68, 170) is a magenta pink, not the darker tone from incorrect expansion.

5 Tips for Hex to RGB Conversion

  • Memorize key hex values: 00 = 0, 80 = 128 (midpoint), FF = 255 (maximum). This lets you estimate that #8040C0 has medium red (128), low green (64), and high blue (192) — a purple shade.
  • Use calculator for precision: While #7B3F2E can be converted manually (red 123, green 63, blue 46), online tools eliminate arithmetic errors when working with multiple colors in a palette.
  • Check for valid hex: Valid codes contain only 0-9 and A-F. #GHI123 is invalid because G, H, and I exceed the base-16 range. CSS will ignore invalid hex codes entirely.
  • Account for alpha channels: Eight-digit codes like #FF573380 include transparency. The last two digits (80 = 128) represent 50% opacity. Convert the first six digits normally, then add alpha: rgba(255, 87, 51, 0.5).
  • Verify with color picker: After converting #2D5016 to rgb(45, 80, 22), use a color picker to confirm the dark forest green matches expectations. Visual verification catches input typos.

4 Hex to RGB FAQs

Hex codes are more compact — six characters versus three numbers with commas and parentheses. Hex is also easier to read at a glance: #FF0000 immediately signals pure red to experienced developers. CSS specifications standardized hex notation in 1996, and it remains the web development convention.

Yes. Divide each RGB value by 16 to get the first hex digit, then use the remainder as the second digit. For rgb(170, 85, 255): 170 ÷ 16 = 10 remainder 10 (AA), 85 ÷ 16 = 5 remainder 5 (55), 255 ÷ 16 = 15 remainder 15 (FF). Result: #AA55FF.

None. #FF5733 and #ff5733 produce identical colors. CSS treats hex letters case-insensitively. Developers often use uppercase for readability (easier to distinguish B from 8) or lowercase for consistency with minified code.

Three-digit shorthand works when each pair contains identical digits. #F0C expands to #FF00CC, saving three characters. This only applies to colors like #000, #FFF, #ABC where doubling each digit produces valid pairs. Most colors require six digits.

Written and reviewed by the CalcToWork editorial team. Last updated: 2026-04-29.

Frequently Asked Questions

Hex codes are more compact — six characters versus three numbers with commas and parentheses. Hex is also easier to read at a glance: #FF0000 immediately signals pure red to experienced developers. CSS specifications standardized hex notation in 1996, and it remains the web development convention.
Yes. Divide each RGB value by 16 to get the first hex digit, then use the remainder as the second digit. For rgb(170, 85, 255): 170 ÷ 16 = 10 remainder 10 (AA), 85 ÷ 16 = 5 remainder 5 (55), 255 ÷ 16 = 15 remainder 15 (FF). Result: #AA55FF.
None. #FF5733 and #ff5733 produce identical colors. CSS treats hex letters case-insensitively. Developers often use uppercase for readability (easier to distinguish B from 8) or lowercase for consistency with minified code.
Three-digit shorthand works when each pair contains identical digits. #F0C expands to #FF00CC, saving three characters. This only applies to colors like #000, #FFF, #ABC where doubling each digit produces valid pairs. Most colors require six digits.