A complete guide to HEX to RGB conversion — covering the math, CSS syntax, HSL and HSV models, CMYK differences, and alpha transparency — with instant conversion tools for designers and developers.
TLDR
Everything you need to know about HEX to RGB conversion:
- HEX and RGB represent the same colors differently. HEX uses a 6-character base-16 code (e.g.
#FF5733), while RGB expresses the same color as three decimal integers between 0 and 255 (e.g.rgb(255, 87, 51)). - The conversion is simple arithmetic. Split the HEX code into three two-character pairs, then convert each pair from base-16 to base-10 to get your R, G, and B values.
- CSS accepts HEX, RGB, HSL, and HSV natively. Each format has distinct advantages depending on whether you are coding a static palette, building dynamic themes, or managing opacity.
- CMYK is a separate color model for print. It operates on ink subtractive mixing, not screen additive mixing, which is why colors often shift when you take a digital design to a printer.
Introduction
Whether you design interfaces in Figma, write CSS by hand, or maintain a brand style guide, you will run into a hex to rgb converter moment sooner or later. Design tools export colors in HEX. CSS properties may expect RGB. APIs return one format when your code needs the other. Each handoff creates a friction point, and without a clear understanding of how these two formats relate, color accuracy slips.
HEX and RGB are both ways to describe the same three-channel additive color model — the one every screen on earth uses. The difference is purely syntactic: HEX packs the three channels into a compact alphanumeric string, while RGB spells each channel out explicitly as a decimal number. Once you know the conversion formula, moving between the two takes seconds. And once you also understand HSL, HSV, and CMYK, you hold a complete picture of how color works across every medium a designer touches. Tools like Inspo AI make this even faster — its free color tools convert between all major formats in one place.
Table of Contents
- What is a HEX to RGB converter and how does it work?
- How do you convert HEX to RGB manually?
- How do you use HEX and RGB colors in CSS?
- What is the difference between RGB and HSL?
- What is HSV and how does it differ from HSL?
- What is the difference between RGB and CMYK?
- Can HEX codes include transparency (alpha channel)?
What Is a HEX to RGB Converter? {#what-is-a-hex-to-rgb-converter}
A HEX to RGB converter is a tool that translates a hexadecimal color code into its equivalent RGB (Red, Green, Blue) values. Both formats represent the same underlying color model — the additive color system that screens use — but they express color values in different number bases.
HEX (hexadecimal) uses base-16 counting, where digits run from 0 through 9 and then A through F (representing 10 through 15). A standard HEX color code looks like #RRGGBB, where each pair of characters maps to one color channel. The full range of each channel is 00 (decimal 0) to FF (decimal 255), giving 256 possible values per channel and 16,777,216 possible colors in total.
RGB expresses those same channel values as plain decimal integers. #FF5733 becomes rgb(255, 87, 51) — the same color written in a different script.
Converters handle this translation automatically, which matters because design tools (Figma, Sketch, Adobe XD) almost always output HEX, while programming contexts (CSS custom properties, JavaScript, SVG, canvas APIs) sometimes require decimal RGB. Consistency across formats is a core part of maintaining brand color accuracy. Retool's color utility overview describes this translation as foundational for any developer or designer working across tools.
How Do You Convert HEX to RGB Manually? {#how-to-convert-hex-to-rgb-manually}
Converting HEX to RGB by hand requires only basic math. The process runs in three steps.
Step 1: Strip the hash and split into pairs.
Take a HEX code like #1A2B3C. Remove the # and split the remaining six characters into three two-character pairs: 1A, 2B, 3C. Each pair represents one color channel — red, green, blue respectively.
Step 2: Convert each pair from base-16 to base-10. In hexadecimal, each digit holds a value from 0 to 15. For a two-digit pair, the left digit multiplies by 16 and the right digit adds directly.
1A= (1 × 16) + 10 = 26 (R)2B= (2 × 16) + 11 = 43 (G)3C= (3 × 16) + 12 = 60 (B)
Step 3: Write the result as an RGB value.
The final output is rgb(26, 43, 60).
This method works for any 6-digit HEX code. For shorthand 3-digit codes like #ABC, expand each digit first (#AABBCC) before splitting.
RapidTables provides a reference table of common conversions if you want to cross-check results. HexCalculator.org also walks through the formula with additional worked examples for every channel range.

Inspo AI's color converter panel outputs all four formats simultaneously — HEX, RGB, HSL, and HSV — from a single input.
How Do You Use HEX and RGB Colors in CSS? {#hex-and-rgb-colors-in-css}
CSS accepts both HEX and RGB natively, and the choice between them affects how readable and maintainable your stylesheet becomes.
HEX syntax is the most compact option:
color: #1A2B3C;
background-color: #FF5733;
RGB syntax uses the rgb() function with three comma-separated integers:
color: rgb(26, 43, 60);
background-color: rgb(255, 87, 51);
Modern CSS also supports the updated space-separated syntax: rgb(26 43 60).
RGBA extends RGB with a fourth parameter — alpha — for transparency control:
background-color: rgba(26, 43, 60, 0.5); /* 50% transparent */
The practical rule: use HEX for static brand colors in your design system, and use RGB or RGBA when you need to compute values dynamically or control transparency without the 8-digit HEX syntax (see the alpha section below).
One important advantage of RGB over HEX is that CSS custom properties compose better with it. Josh W. Comeau's deep guide to CSS color formats shows how storing a color as separate R, G, B channel variables lets you apply opacity at usage time: --color-brand: 26 43 60; and background: rgb(var(--color-brand) / 0.5);. DEV Community covers the alpha value syntax for all CSS color formats in further detail.
What Is the Difference Between RGB and HSL? {#rgb-vs-hsl}
RGB and HSL describe the same set of colors but through entirely different conceptual frameworks.
RGB maps to the physics of your screen. Each pixel emits red, green, and blue light at different intensities. To get orange, you mix high red, medium green, and zero blue. The model is technically precise but not particularly intuitive — most designers do not think "more red and a bit more green" when they want a warmer tone.
HSL (Hue, Saturation, Lightness) organizes color the way human perception works.
- Hue is the base color, expressed as an angle on a 360-degree color wheel (0 = red, 120 = green, 240 = blue).
- Saturation is the intensity or vividness of the color, from 0% (grey) to 100% (fully vivid).
- Lightness is how bright the color is, from 0% (black) through 50% (pure color) to 100% (white).
So #1A2B3C in HEX (rgb(26, 43, 60) in RGB) becomes hsl(210, 40%, 17%) in HSL. That HSL value immediately tells a designer: this is a dark blue-leaning steel tone with moderate saturation. The RGB values give no such quick read.
CSS supports HSL directly: color: hsl(210, 40%, 17%);. It also supports hsla() for transparency. Programming Design Systems offers an excellent breakdown of why HSL maps better to how designers choose and adjust colors. Inspo AI's brand scanner outputs HSL values alongside HEX and RGB, so you always have the full picture.
What Is HSV and How Does It Differ from HSL? {#hsv-vs-hsl}
HSV (Hue, Saturation, Value) and HSL look nearly identical on paper but model lightness differently, which produces noticeable differences at the extremes.
Both formats share the Hue axis — the same 0-360 degree color wheel. The difference is in the third component.
HSL Lightness places pure, fully-saturated colors at the midpoint (50%). At 100% lightness, any color becomes white. At 0%, any color becomes black. This creates a symmetrical model where brightness increases evenly from both ends.
HSV Value (sometimes called Brightness in HSB) defines a different behavior. At 100% value, you get the pure hue at full intensity. Reducing value darkens the color toward black, but you cannot reach white by increasing value — only by reducing saturation. This makes HSV better aligned with how artists think about adding black to a paint color.
In practice, HSL is the web standard — CSS exposes hsl() and hsla() natively. HSV dominates design tool color pickers — Figma, Photoshop, and Illustrator all use HSV/HSB under the hood when you drag the color picker.
This distinction matters when you convert a color extracted from a design file for use in CSS. The HEX to RGB conversion step is the same for both, but if you also need the perceptual color coordinates, knowing which H-S-? model applies avoids subtle mismatches. Wikipedia's HSL and HSV article provides the full geometric comparison, and Tobia Montanari's explainer covers the practical implications for digital colorists.
What Is the Difference Between RGB and CMYK? {#rgb-vs-cmyk}
RGB and CMYK serve different physical processes for producing color, which is why the same brand color can look noticeably different on screen versus in print.
RGB is an additive model. Screens produce color by emitting light. Red, green, and blue light combine to create colors — mix all three at full intensity and you get white. This works because screens generate their own light source.
CMYK is a subtractive model. Printers produce color by depositing ink on paper, which absorbs (subtracts) wavelengths of light. The four ink channels are Cyan, Magenta, Yellow, and Key (Black). Mix all four at maximum and you theoretically get black (in practice you get a muddy dark brown, which is why black ink is separate).
The critical design implication: the RGB color gamut is wider than CMYK. Many vivid RGB colors — neon greens, electric blues, saturated reds — have no printable CMYK equivalent. When you prepare a digital design for print and export from RGB, the printer or prepress software must remap those out-of-gamut colors to the closest printable equivalent, often producing washed-out or shifted results.
For brand consistency, VistaPrint's RGB vs CMYK guide recommends designing in CMYK from the start when the primary output is print. For digital-first assets (web, app UI, social media), RGB and HEX remain the correct choice. Jukebox Print's 2026 guide confirms that sending an RGB file to a commercial printer produces unpredictable color shifts without soft-proofing.

Inspo AI's brand scanner extracts colors from any logo or design and displays each swatch in all formats simultaneously — HEX, RGB, HSL, and CMYK — so you never have to convert manually.
Can HEX Codes Include Transparency (Alpha Channel)? {#hex-alpha-transparency}
Yes — modern CSS supports 8-digit HEX codes that append an alpha (opacity) value to the standard 6-digit format.
The structure is #RRGGBBAA, where the last two hexadecimal digits represent the alpha channel from 00 (fully transparent) to FF (fully opaque). For example:
background: #00FF0080; /* 50% transparent green */
background: #1A2B3CFF; /* fully opaque dark blue */
background: #1A2B3C00; /* fully transparent dark blue */
The alpha-to-hex conversion follows the same base-16 math as the color channels. 50% opacity in decimal terms is 127.5, which rounds to 128, which in hexadecimal is 80. This non-obvious mapping is why many developers still prefer rgba() syntax for transparency — the alpha value there is a straightforward decimal between 0 and 1.
CSS also supports 4-digit shorthand HEX (#RGBA), which expands each digit by doubling it, just like 3-digit shorthand: #F008 expands to #FF000088.
Browser support for 8-digit HEX is now universal across all modern browsers, including Chrome (since version 52), Firefox, Safari, and Edge. CSS-Tricks was among the first to document this feature when Chrome shipped it. DigitalOcean's tutorial covers the full syntax with practical CSS examples. Ben Frain's guide makes the case for 8-digit HEX as the cleanest way to add opacity without converting your entire color system to RGBA.
Conclusion
Understanding the relationship between HEX, RGB, HSL, HSV, and CMYK turns color from a source of friction into a design superpower. HEX is compact and universal for static palettes. RGB composes cleanly with CSS variables and transparency. HSL describes color the way designers think. HSV matches how color pickers in design tools work. CMYK governs the physical world of print. Knowing when and how to convert between them is foundational craft.
If you want all of these conversions in one place, Inspo AI's free color tools give you instant multi-format output — type in a HEX code and get RGB, HSL, HSV, and CMYK simultaneously. The brand scanner also extracts colors directly from logos and design assets, outputting every format in a single clean panel. No more tab-hopping between five different converter sites.
Try it now at inspoai.io/free-tools.
