What is the HEX to RGB Converter?
Convert HEX colour codes to RGB values instantly. Supports 3-digit and 6-digit HEX, with and without the # prefix.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the HEX to RGB Converter
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Enter your HEX code
Type or paste a 3 or 6 digit hex code, with or without the # prefix. The converter accepts all common formats.
Get the RGB output
The RGB and RGBA values appear instantly. Each channel (red, green, blue) is displayed separately for easy reference.
Copy the format you need
Click Copy next to rgb() or rgba() to grab the value. Or copy individual channel numbers to use in custom property definitions.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
/* HEX input */
color: #6C2EF5;
/* RGB output */
color: rgb(108, 46, 245);
/* RGBA - add alpha for transparency */
color: rgba(108, 46, 245, 0.5);
/* As CSS custom property components */
--brand-rgb: 108, 46, 245;
.tint { background: rgba(var(--brand-rgb), 0.1); }Storing colour components as --brand-rgb: r, g, b lets you compose rgba() values at any opacity without redefining the colour.
Pro tips for better results
3-digit HEX is shorthand for 6-digit
#f0a is identical to #ff00aa. Each digit is doubled: f becomes ff, 0 becomes 00, a becomes aa. The converter accepts both forms.
Store components as CSS custom properties for flexibility
Define --brand: 108, 46, 245 (just the numbers), then compose: rgb(var(--brand)) for solid or rgba(var(--brand), 0.5) for transparent versions anywhere in your CSS.
rgb() and rgba() are interchangeable in modern CSS
In Chrome 65+, Firefox 52+, and Safari 12.1+, rgb() accepts a fourth alpha parameter: rgb(108 46 245 / 50%). The rgba() four-argument form still works everywhere.
Frequently asked questions
From the blog
Read more →CSS clamp() and Fluid Typography: Stop Writing Font-Size Media Queries (2026)
Learn how CSS clamp() creates type that scales smoothly between screen sizes with a single line, the formula behind it, and how to build a fully fluid type scale without media queries.
CSS Grid vs Flexbox: Which Should You Use? (2026)
CSS Grid vs Flexbox, settled. Here's a senior dev's honest breakdown of when to use each, with real code examples, a comparison table, and no hedging.
CSS Animations: A Practical Guide to Keyframes and Transitions (2026)
Learn the difference between transitions and keyframe animations, how to write @keyframes, the properties worth animating for 60fps, and easing that actually looks good.