Fading a gradient to transparent sounds simple, but using the CSS "transparent" keyword produces an unwanted grey band at the transition zone.
Loading Gradient…
Generates rgba-based transparent stops to prevent grey banding
Choose fade direction: horizontal, vertical, or diagonal
Use for overlays, masks, and edge-fade effects
Output is a single background declaration ready to apply
Drop the Gradient into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/gradient?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Gradient by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
The CSS keyword "transparent" is formally defined in the specification as rgba(0, 0, 0, 0), which is fully transparent black. When the browser interpolates a gradient between a vivid colour and this transparent keyword, it blends not only the alpha channel but also all three colour channels, passing through black as alpha decreases toward zero. The midpoint of a blue-to-transparent gradient calculated this way passes through a desaturated, dark grey value before reaching full transparency, because the blue colour channels are being blended with the zeros of the black channel simultaneously. The resulting dark band at the transition zone is especially obvious on light backgrounds, on gradients with a short fade distance, and on elements that sit over images or bright backgrounds. The fix is straightforward and reliable: replace the transparent keyword with the exact gradient colour at alpha 0. For a colour of #667eea (rgb 102, 126, 234), the correct transparent stop is rgba(102, 126, 234, 0). Interpolating between rgba(102, 126, 234, 1) and rgba(102, 126, 234, 0) only changes the alpha channel while holding the colour channels constant, producing a clean fade through the colour itself with no grey or dark artefact at any point in the transition.
Transparent gradients are used in several distinct and important CSS patterns. Overlay gradients on images use a dark-colour-to-transparent gradient to progressively darken the lower portion of a photo for text legibility without physically cropping or obscuring the image. Edge-fade masks apply a content-colour-to-transparent gradient using the CSS mask-image property on a container to make scrollable content visually dissolve at the edge, which clearly signals to users that more content exists off-screen. Section transition overlays use a page-background-colour-to-transparent gradient at the top or bottom of a page section to create a smooth visual handoff between sections with different background colours. Background-blend-mode gradients use semi-transparent gradient layers combined with the background-blend-mode property to create colour tinting and duotone effects on background images. In all of these cases, the rgba correction for transparent stops is essential for a clean, professional result.
FixTools generates the rgba-corrected transparent gradient CSS for any chosen colour and fade direction. The output always uses the rgba(r, g, b, 0) form for the transparent stop rather than the keyword, ensuring artefact-free rendering across all browsers and background contexts. Copy the background declaration and apply it directly to your element or to a pseudo-element overlay layer.
Modern CSS now offers two alternative syntaxes that simplify writing transparent gradient stops once you know they exist. The first is eight-digit hex notation: #667eea00 expresses the same colour as rgba(102, 126, 234, 0) but in a more compact form. The trailing 00 is the alpha channel in hex (zero being fully transparent, ff being fully opaque). The second is the relative colour syntax from CSS Color Level 5: linear-gradient(to right, #667eea, rgb(from #667eea r g b / 0)) lets you derive the transparent equivalent of a colour without manually converting the channels. The relative syntax keeps the source colour as the single source of truth, so updating the gradient colour later requires changing only one value rather than recalculating the rgba transparent stop separately. Browser support for relative colour syntax reached all major browsers during 2024, making it production-ready for most projects today.
Create a fade-to-transparent gradient. Example: background: linear-gradient(to bottom, rgba(102, 126, 234, 1) 0%, rgba(102, 126, 234, 0) 100%)
Step-by-step guide to transparent gradient css:
Open the CSS Gradient Generator
Navigate to the FixTools CSS Gradient Generator. For transparent gradients, you will set one colour stop as your fully opaque starting colour and the other as a transparent stop. The generator automatically uses the rgba(r, g, b, 0) form of your chosen colour for the transparent stop rather than the CSS transparent keyword, preventing grey banding in all browsers.
Set your colour stop
Add your primary gradient colour as the opaque stop at the starting position of the fade. This is the colour that will be fully visible at one end of the gradient before it transitions to transparency. Set it at the position where you want the gradient to be at full opacity: 0% for a start-to-transparent fade or 100% for a transparent-to-colour fade.
Add the transparent stop
Add the transparent end stop at the position where you want the gradient to have fully faded out. The tool uses the rgba(r,g,b,0) form of your chosen opaque colour for this stop, ensuring the transition fades through the colour itself rather than through black. This is the technically correct approach that prevents the grey banding caused by the CSS transparent keyword.
Copy and apply as overlay
Copy the gradient CSS output and apply it to a pseudo-element, an absolutely positioned overlay div, or the container element itself depending on your intended effect. For image overlays and vignettes, use a ::before or ::after pseudo-element with position: absolute; inset: 0 covering the image. For edge-fade masks on scrollable containers, use the mask-image property instead of background.
Common situations where this approach makes a real difference:
Image overlay for text legibility
A news and editorial site displays featured article images with a headline and byline overlaid at the lower portion of each image. Without any overlay treatment, white or light-coloured text on sky or cloud backgrounds has critically insufficient contrast for accessibility. The developer applies a pseudo-element with position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 55%) positioned over each image. The overlay progressively darkens the lower 55% of each image, providing a high-contrast dark ground for the text while preserving the photographic subject in the unaffected upper portion of the image frame.
Horizontally scrollable tag list edge fade
A product filter interface uses a row of tag chip buttons that overflows the container width on small viewports. On mobile, most filter chips are not visible without scrolling. The developer applies mask-image: linear-gradient(to right, black 80%, rgba(0,0,0,0) 100%) to the chips container. The visible tags appear at full opacity up to the 80% mark, then fade to transparent over the final 20%, making it visually obvious that more chips extend beyond the visible area and guiding the user to scroll horizontally without relying on a static right-arrow icon.
Full-viewport gradient that merges into a white section
A dark coloured hero section sits directly above a white content section and the hard horizontal colour boundary between them looks abrupt and poorly finished. The developer adds a transition div at the bottom of the hero with height: 60px and background: linear-gradient(to bottom, rgba(15, 52, 96, 0) 0%, rgba(255, 255, 255, 1) 100%). This small element creates a smooth visual blend from the deep navy hero background into the white section, producing a professional and considered layout transition with only five CSS declarations and no change to the surrounding section markup or layout.
Tooltip or popover background with fade edges
A data-dense analytics dashboard displays contextual tooltips for chart data points. The tooltip content occasionally exceeds the compact tooltip container height. The developer overlays a transparent gradient from rgba(255,255,255,0) at 70% to rgba(255,255,255,1) at 100% at the tooltip bottom using a positioned pseudo-element. This signals to users that the tooltip text is truncated and more content is available. The gradient uses rgba(255,255,255,0) rather than transparent to prevent the characteristic grey band that would otherwise appear over the white tooltip background at the fade midpoint.
Use this when you need a gradient that fades to nothing: overlay effects on images, text masks on scrollable content, or edge-fade overlays on carousels.
Get better results with these expert suggestions:
Always use rgba(r, g, b, 0) instead of transparent
The CSS keyword transparent equals rgba(0,0,0,0), which introduces grey or dark banding when blended with any colour other than pure black because all three colour channels are interpolated through zero simultaneously. Replace every transparent stop with the gradient's actual colour at alpha 0. For hex colour #667eea, convert the channels to decimal (102, 126, 234) and write rgba(102, 126, 234, 0). This single substitution eliminates grey banding in virtually all practical gradient contexts with no other changes required.
Use mask-image with a transparent gradient for edge fades
To make content visually dissolve at the edge of a container without clipping it, use mask-image: linear-gradient(to right, black 70%, rgba(0,0,0,0) 100%) on the container element. The fully opaque black region of the mask shows the content at full opacity, and the transparent region fades it out smoothly. This technique is ideal for horizontal scrollable tag lists, navigation chip bars, and image carousels where you want to hint at off-screen content without adding hard clip edges or explicit scroll indicator controls.
Layer two transparent gradients for a bidirectional edge fade
To fade both the left and right edges of a scrollable container simultaneously, stack two background layers using comma-separated values: background: linear-gradient(to right, white 0%, rgba(255,255,255,0) 15%), linear-gradient(to left, white 0%, rgba(255,255,255,0) 15%). Apply this to a pseudo-element with position: absolute; inset: 0; pointer-events: none layered above the scrollable content. The pointer-events: none ensures the overlay does not block click and scroll interactions with the content beneath it.
Use a short transparent stop position for a crisp overlay edge
Setting the rgba alpha-0 stop at 40% or 50% rather than at 100% means the gradient reaches full transparency by the element midpoint and then stays transparent for the remainder. For dark overlay effects where you only need the darkened region at the bottom of a photo, use: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 40%). This concentrates the dark overlay in the lower 40% of the image, leaving the upper 60% completely unaffected and clear for image detail or focal subject matter.
More use-case guides for the same tool:
Open the full Gradient — free, no account needed, works on any device.
Open Gradient →Free · No account needed · Works on any device