HEX to RGB Conversion Explained with Examples and Formulas
Understand how HEX color codes translate to RGB values. Learn the conversion formula, see practical examples, and use our free converter tool.
What are HEX and RGB Color Codes?
HEX and RGB are two ways to represent the same thing: a color on a screen. Every color you see on a digital display is made by mixing red, green, and blue light in different amounts. RGB specifies those amounts directly as numbers from 0 to 255. HEX represents the same numbers using hexadecimal notation.
For example, pure red is rgb(255, 0, 0) in RGB notation and #FF0000 in HEX. Both describe the same color: maximum red, no green, no blue.
How HEX Codes Work
A HEX color code is a six-character string preceded by a hash symbol. The six characters are three pairs: red, green, and blue.
#FF5733
^^ ^^ ^^
R G B
FF = Red channel = 255 in decimal
57 = Green channel = 87 in decimal
33 = Blue channel = 51 in decimal
So #FF5733 = rgb(255, 87, 51)The Conversion Formula
Hex to Decimal conversion:
First digit x 16 + Second digit = Decimal value
Example: #3498DB
Red: 34 -> (3 x 16) + 4 = 52
Green: 98 -> (9 x 16) + 8 = 152
Blue: DB -> (13 x 16) + 11 = 219
Result: rgb(52, 152, 219)Common Color Conversions
| Color | HEX | RGB |
|---|---|---|
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Coral | #FF7F50 | rgb(255, 127, 80) |
| Teal | #008080 | rgb(0, 128, 128) |
When to Use HEX vs RGB
- HEX is shorter and more common in design tools like Figma. Use it for solid colors.
- RGB is better when you need transparency via rgba(255, 87, 51, 0.5).
- Modern CSS also supports hex with alpha: #FF573380 but rgba() is more readable.
Shorthand HEX Codes
#FFF = #FFFFFF (white)
#000 = #000000 (black)
#F00 = #FF0000 (red)
#09F = #0099FF (sky blue)Free HEX to RGB Converter
Convert hex color codes to RGB values instantly with live color preview.
Try it freeRelated Articles
Understanding Color Codes: HEX, RGB, and HSL for Beginners
A beginner-friendly guide to web color formats. Learn how HEX, RGB, and HSL work, when to use each one, and how to convert between them easily.
DesignPX to CM Converter: Screen Pixels to Print Measurements Explained
Learn how to accurately convert pixels to centimeters for print design. Covers DPI, screen resolution, and provides a free converter with adjustable settings.
DesignHSL Color Model Explained: Why Designers Prefer It Over RGB
Learn why HSL is more intuitive than RGB for color selection. Understand hue, saturation, lightness, and how to create harmonious color palettes with HSL.