Hex to RGB Tool
Color precision. Convert Hexadecimal colors to RGB and generate clean snippets for your CSS variables and design systems.
#6366F1
CSS Outputs
RGB
rgb(99, 102, 241)
Variable
99, 102, 241
RGBA (0.5)
rgba(99, 102, 241, 0.5)
The Power of RGB in CSS
I genuinely believe that every modern design system should use RGB-based CSS variables. While HEX codes are easy to read, they don't allow you to adjust opacity on the fly. By storing your color as a comma-separated list of numbers (e.g., `99, 102, 241`), you can use it in your CSS like this: `background: rgba(var(--brand-color), 0.1);`.
Hex vs. RGB: Hexadecimal is a base-16 system, while RGB represents the intensity of Red, Green, and Blue on a scale from 0 to 255. Both systems represent the exact same color gamut in the sRGB space.
Web Design Tips:
- Contrast: Always check that your text color has enough contrast against the background. Use the preview box above to see how white text looks on your selected color.
- Shorthand: You can use 3-digit hex codes (like #F00) for simple colors, but 6-digit codes are standard for professional design systems.
- HSLA: If you need to adjust brightness or saturation, consider using HSL (Hue, Saturation, Lightness), which is often more intuitive than RGB.