HEXA to HSLA Converter
Turn HEXA color codes into hsla(h, s, l, a) values without calculating anything by hand. This converter is helpful when exports or design tokens use HEX with alpha, but your CSS or docs work with HSLA.
Enter a color in HEXA format and you will see the matching HSLA notation right away. You can then copy the hsla() call into your styles, theme files, or component props.
On this page you will also find a short explanation of HEX with alpha and HSLA, a clear conversion formula, a detailed step-by-step breakdown, a reference table, and a FAQ that covers typical questions about these formats.
What Is a HEXA Color Code
A HEXA value extends the classic HEX format with transparency. Instead of #RRGGBB it uses #RRGGBBAA, where the last two characters encode the alpha channel.
All four pairs are hexadecimal numbers in the range from 00 to FF. The first three pairs control red, green, and blue, just like in a regular HEX color. The final pair defines opacity: 00 means fully transparent, FF means fully opaque.
Browsers and tools read each pair, convert it to decimal, and then treat the first three as RGB channels and the last one as an alpha value between 0 and 255. This makes HEXA a compact way to store both color and transparency in a single string.
What Is HSLA
HSLA is the HSL color model with an alpha channel. It is written as hsla(h, s, l, a), where h is the hue angle, s is saturation, l is lightness, and a is the opacity value.
Hue is measured in degrees from 0 to 360. Saturation and lightness are percentages from 0% to 100%. The alpha component is a number from 0 to 1, where 0 represents full transparency and 1 represents full opacity.
HSLA is comfortable for design work because you can adjust hue separately from intensity and brightness, and still control transparency with a fourth parameter. It is widely supported in modern CSS.
HEXA to HSLA Conversion Formula
#RRGGBBAA -> hsla(h, s, l, a)
1) Split the HEXA string:
#RRGGBBAA -> RR, GG, BB, AA
2) Convert each pair from hex to decimal:
R = hex_to_dec(RR)
G = hex_to_dec(GG)
B = hex_to_dec(BB)
A = hex_to_dec(AA)
3) Normalize the alpha channel:
a = A / 255
4) Convert RGB to HSL:
r' = R / 255
g' = G / 255
b' = B / 255
max = max(r', g', b')
min = min(r', g', b')
delta = max - min
// Lightness:
l = (max + min) / 2
// Saturation:
if delta == 0 then s' = 0
else s' = delta / (1 - |2 * l - 1|)
// Hue:
if delta == 0 then h = 0
else if max == r' then h = 60 * (((g' - b') / delta) mod 6)
else if max == g' then h = 60 * (((b' - r') / delta) + 2)
else if max == b' then h = 60 * (((r' - g') / delta) + 4)
5) Scale to final units:
H = h
S = s' * 100
L = l * 100
6) Compose HSLA:
hsla(H, S%, L%, a)
Helper:
hex_to_dec("FF") = 255
hex_to_dec("00") = 0The red, green, and blue components are handled just like in any HEX to HSL conversion. The alpha pair is only used to compute the final a value for HSLA, so the color itself does not change, only its transparency.
Example for #4FA3C2CC
1) Pairs:
RR = 4F, GG = A3, BB = C2, AA = CC
2) Decimal values:
R = 79, G = 163, B = 194, A = 204
3) Alpha:
a = 204 / 255 (about 0.8)
4) Convert (79, 163, 194) to HSL:
hsl(196, 49%, 54%) (rounded)
5) Final HSLA:
hsla(196, 49%, 54%, 0.8)How HEXA to HSLA Conversion Works Step by Step
Under the hood, HEXA to HSLA conversion is a combination of HEX to RGB, RGB to HSL, and a simple normalization of the alpha channel. You unpack all channels from their hexadecimal form and then remap them into the HSLA model.
#1A2B3C80
-> [1A, 2B, 3C, 80]
-> rgb(r, g, b) + alpha
-> hsla(h, s, l, a)Here is a more detailed look at what happens with #1A2B3C80.
- Step 1 - Decode the HEX pairs
Split the string into four pairs and convert each one from base 16 to base 10. The first three become R, G, and B, and the last one becomes the raw alpha value.
RR = 1A -> 26 GG = 2B -> 43 BB = 3C -> 60 AA = 80 -> 128 - Step 2 - Compute H, S, and L from RGB
Normalize the RGB channels to the range from 0 to 1, find the maximum and minimum values, then use the standard HSL equations to derive hue, saturation, and lightness.
r' = 26 / 255 g' = 43 / 255 b' = 60 / 255 l = (max + min) / 2 ... -> hsl(210, 39%, 17%) (rounded) - Step 3 - Normalize alpha and build HSLA
Divide the alpha value by 255 and plug everything into the
hsla()function.hsla(210, 39%, 17%, 0.5)
The same sequence of steps works for any valid HEXA color, so using a converter or helper function is usually the safest and fastest option.
Choosing Between HEXA and HSLA
HEXA and HSLA both describe the same underlying data: color plus transparency. The main difference is whether you optimize for compact storage or for human readability and editing.
When HEXA Is a Good Fit
- Design tokens and theme files: short strings like
#4FA3C2CCare easy to keep in JSON or configuration objects. - Copying from design tools: many graphics editors export colors in HEX with alpha, which can be pasted directly into a token set.
- Shared palettes: HEXA codes are compact and work well in large lookup tables of semantic colors.
When HSLA Is More Practical
- Fine tuning themes: the explicit hue, saturation, and lightness values in HSLA are easier to adjust than three raw channels in HEX.
- Explaining design decisions: values like
hsla(210, 40%, 20%, 0.7)are easier to discuss in specs than eight digit hex codes. - Using modern CSS features: HSLA fits naturally with other HSL based color utilities and mixing techniques.
Summary
Use HEXA when you want compact tokens and easy copy and paste. Convert those values to HSLA when you need readable, tweakable parameters for themes, components, or documentation.
Best Practices for Using HEXA and HSLA Together
It is normal to maintain both HEX and HSL based colors in a single project. A few conventions help keep the system maintainable.
Define a Source of Truth
- Pick one main format for tokens: many teams choose HEXA for raw tokens and derive HSLA values on demand.
- Keep conversions automatic: avoid hand-editing alpha or channel values in multiple places; rely on scripts or utilities instead.
Combine With Other Color Models
- Move through RGB when needed: conversions between HEXA, HSLA, and other models usually go through RGB under the hood.
- Clamp values safely: always keep hue, saturation, lightness, and alpha in their valid ranges when animating or generating variants.
Keep the Palette Consistent
- Document how formats are used: for example, HEXA for tokens, HSLA in docs and code samples, and RGBA in low level drawing code.
- Use utilities rather than manual math: this reduces errors and keeps large theme updates easier to manage.
With clear rules and automatic conversions, you can take advantage of both HEXA and HSLA without sacrificing clarity in your styles and design system.
HEXA to HSLA Conversion Table
The table below lists a few common colors with transparency in both HEXA and HSLA forms. Values are rounded for readability, so rely on the converter above when you need exact numbers.
| Description | HEXA | HSLA |
|---|---|---|
| White 50% | #FFFFFF80 | hsla(0, 0%, 100%, 0.5) |
| Black 50% | #00000080 | hsla(0, 0%, 0%, 0.5) |
| Red 80% | #FF0000CC | hsla(0, 100%, 50%, 0.8) |
| Green 40% | #00FF0066 | hsla(120, 100%, 50%, 0.4) |
| Blue 30% | #0000FF4D | hsla(240, 100%, 50%, 0.3) |
| Yellow 60% | #FFFF0099 | hsla(60, 100%, 50%, 0.6) |
| Cyan 70% | #00FFFFB3 | hsla(180, 100%, 50%, 0.7) |
| Magenta 90% | #FF00FFE6 | hsla(300, 100%, 50%, 0.9) |
| Overlay gray | #11111180 | hsla(0, 0%, 7%, 0.5) |
| Soft gray | #33333380 | hsla(0, 0%, 20%, 0.5) |
| Panel border | #55555580 | hsla(0, 0%, 33%, 0.5) |
| Accent orange 70% | #FFA500B3 | hsla(39, 100%, 50%, 0.7) |
| Purple overlay | #80008080 | hsla(300, 100%, 25%, 0.5) |
| Teal overlay | #00808080 | hsla(180, 100%, 25%, 0.5) |
For any other HEXA value you can use the converter at the top of the page to compute the corresponding HSLA color using the standard algorithm.
FAQ: HEXA to HSLA
- How is HEXA different from HEX
HEX uses six digits for RGB only. HEXA extends this to eight digits by adding an alpha pair, so it can describe both color and transparency.
- Why convert HEXA to HSLA
HSLA makes it easier to tweak hue, saturation, and lightness independently, while still keeping alpha as a separate parameter. This is especially useful when adjusting themes or documenting design decisions.
- Does conversion change the visual color
No. A correctly converted HSLA value represents the same color and transparency as the original HEXA string. Only the way you write the color changes.
- Can I move back from HSLA to HEXA
Yes. You can convert HSLA to RGB, multiply the alpha value by 255, and then turn all four numbers into two digit HEX pairs to rebuild the HEXA string.
- Should I use HSLA or RGBA in CSS
Both are valid. HSLA is often more intuitive when you adjust palettes and themes, while RGBA can be convenient when you already work in the RGB model. Many projects mix both, depending on context.
Related Converters:
HEXA to RGBA Converter
Instantly calculate hexa to rgbaHEXA to HSVA Converter
Instantly calculate hexa to hsvaRGBA to HEXA Converter
Instantly calculate rgba to hexaRGBA to HSLA Converter
Instantly calculate rgba to hslaRGBA to HSVA Converter
Instantly calculate rgba to hsvaHSLA to HEXA Converter
Instantly calculate hsla to hexa