How to convert hex to RGB: the web developer's color format explained

Hex color codes like #3B82F6 are just RGB values written in hexadecimal. The first two characters are red (3B = 59), the middle two are green (82 = 130), and the last two are blue (F6 = 246). Hex is the dominant color format on the web because it's compact, universally supported, and easy to copy-paste between design tools and code.

Format
HEX
Example: #3B82F6
Category
Web Formats
Color knowledge base

Calculator

Back to Home

Color Picker

Pick colors and convert between formats.

239°

How this is calculated

Hex colors originated in HTML 3.2 and haven't changed since. The format is case-insensitive (#3b82f6 = #3B82F6) and supports shorthand when each channel uses identical hex digits (#FFF = #FFFFFF). The main limitation of hex is that it doesn't support an alpha channel. For transparency, you need the 8-digit hex format (#3B82F6CC) which adds RGBA support, or you switch to the rgba() functional notation in CSS.

Verdict

Hex is the right format for opaque colors in web development. It's shorter than rgb(), universally recognized, and copy-pastes cleanly between Figma, VS Code, and browser DevTools. Use the 8-digit variant or rgba() when you need transparency.

More Web Formats scenarios

Frequently asked questions

Is #FFF the same as #FFFFFF?
Yes. CSS expands 3-digit hex shorthand by doubling each digit. #FFF becomes #FFFFFF (white), #F00 becomes #FF0000 (red). This only works for 3-digit codes where each channel has identical hex digits.