CSS filter: drop-shadow() Generator
The CSS filter: drop-shadow() function creates a shadow that follows the actual rendered outline of an element, including transparent areas of PNG images and complex SVG paths.
1. drop-shadow()pxpxpx
.image {
filter: drop-shadow(6px 8px 10px rgba(0, 0, 0, 0.35));
}

Functions run top to bottom, in the order written. Your image stays in your browser; it is not uploaded.
drop-shadow() that follows the shape of transparent images
X and Y offset, blur, colour and shadow opacity controls
Starts on a cut-out sample with a transparent background
Try it on your own PNG or SVG; nothing is uploaded
- Cost
- Free tier
- Sign-up
- Not required
- Processing
- Tool-specific
- Privacy
- Clearly disclosed
Add this Filter Effects Builder to your website
Drop the Filter Effects Builder into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.
- One copy-ready line of HTML
- Responsive — adapts to any container width
- No API credentials are placed in the snippet
Embed code
<iframe
src="https://www.fixtools.io/css-tool/filter-effects-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Filter Effects Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
How filter: drop-shadow() Follows Shape Outlines and How It Differs from box-shadow
The box-shadow property applies a shadow to the CSS box model of an element, which is always rectangular and follows the border radius rather than the actual visible content. For any img element containing a PNG with a transparent background, the box-shadow produces a rectangular shadow around the image file dimensions, not the visual content within it. A star shaped icon, a circular avatar with a square PNG container, or a die cut product photograph renders with a rectangular shadow that completely misrepresents the visible shape and instantly reads as broken to anyone who notices it. The filter: drop-shadow() function operates differently: it processes the composited pixel output of the element, identifies non transparent pixels using the alpha channel of the rendered output, and generates a shadow from those pixels alone. The result is a shadow that traces the actual shape of the visible content, whether that is a star, a custom logo mark, an irregular SVG path, or text with unusual decorative letterforms.
The syntax for drop-shadow is filter: drop-shadow(offsetX offsetY blur colour). Unlike box-shadow, there is no spread value: the function accepts only three length values, namely horizontal offset, vertical offset, and blur radius, followed by a colour expression. Chaining multiple drop-shadows requires listing each as a separate drop-shadow() call within the same filter property, separated by spaces rather than commas, as in filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3)) drop-shadow(-1px -1px 2px rgba(0,0,0,0.1)). The syntax difference from box-shadow means that developers moving from box-shadow to drop-shadow occasionally include a fourth length value for spread and produce unexpected results, because the fourth length makes the declaration invalid, so the browser silently ignores the whole filter and no shadow appears. Always reach for the FixTools generator output to confirm valid syntax before committing the rule.
Performance differences between drop-shadow() and box-shadow are worth understanding for animated use cases and large element treatments. box-shadow is composited at the element edge level and the browser handles it efficiently using rectangle blur primitives that are well optimised on every modern GPU. filter: drop-shadow() requires the browser to process the element full pixel output to trace alpha boundaries before rendering the shadow, which is a more expensive operation per frame. For small icons at typical sizes of 16px to 48px, this cost is negligible and you should not hesitate to use it freely. For large elements with complex transparency, particularly SVG illustrations with many paths and gradients, drop-shadow() processing cost increases proportionally to the rendered area. For large rectangular elements like cards where a box-shadow would be acceptable, prefer box-shadow. For icons, badges, logos, and small PNG images where shape accuracy matters, drop-shadow() is the right tool and the cost is invisible to users.
Colour and opacity choices in drop-shadow() materially affect how natural the shadow reads against the background it sits on. A solid black at rgba(0,0,0,1) produces a heavy theatrical shadow that rarely looks right outside of stylised illustration contexts. Most production shadow treatments use black at 0.15 to 0.35 alpha, which mimics the way real shadows from soft light sources appear in photographs. For shadows on coloured or warm backgrounds, consider using a tinted shadow colour that picks up the surface tone, for example rgba(40, 30, 20, 0.3) on a beige surface instead of pure black, which keeps the shadow from looking artificially cool and out of place. The FixTools tool has a colour picker and a separate shadow opacity slider and writes the result as an rgba() value, so you can match a palette colour, set its strength and confirm the rendered result against representative content in the live preview before locking in the value.
How to use this tool
The tool starts with a drop-shadow on a cut-out character with a transparent background, so the shadow follows its outline rather than a rectangle. Set the X and Y offsets, blur, colour and shadow opacity, try it on your own transparent PNG, then copy the rule.
How It Works
Step-by-step guide to css filter: drop-shadow() generator:
- 1
Check that you need a shape-following shadow
drop-shadow() follows the visible outline of transparent PNGs, SVGs and other non-rectangular content. For rectangular cards and buttons, box-shadow is simpler and also supports a spread radius, which drop-shadow() does not.
- 2
Set offset and blur
Use the X offset and Y offset sliders (-30 to 30 px) to place the shadow, and the Blur slider (0 to 40 px) to soften its edge.
- 3
Choose colour and opacity
Pick the shadow colour with the colour field and set Shadow opacity. The tool writes the colour as rgba(), for example drop-shadow(6px 8px 10px rgba(0, 0, 0, 0.35)).
- 4
Copy the CSS
Click Copy CSS. The output is a complete rule you can paste into your stylesheet; rename the .image selector to match your element.
Real-world examples
Common situations where this approach makes a real difference:
Navigation logo shadow on variable background
A site has a sticky navigation bar that overlaps both a white hero section and a dark navy features section as users scroll. The PNG logo needs a shadow that looks correct against both backgrounds. The developer applies filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)) to the logo element. The shape-following shadow renders correctly on both light and dark backgrounds, where a box-shadow would have shown a rectangular artifact on the dark section.
SVG icon hover lift effect
A tool palette in a web app has SVG icon buttons that need a hover state communicating interactivity. The developer applies filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)) on :hover with transform: translateY(-1px) and transition: filter 0.15s ease, transform 0.15s ease. The shadow follows each icon path exactly, producing polished lift feedback across all icon shapes in the palette without any per-icon adjustments.
Product cutout photography shadow
An online store uses product photographs shot on white backgrounds that are then converted to PNGs with transparent backgrounds for display on a grey product page. box-shadow on these images produces visible rectangular halos. Switching to filter: drop-shadow(3px 3px 8px rgba(0,0,0,0.2)) makes the shadow follow each product outline accurately, producing a natural-looking photograph-on-surface effect that would otherwise require retouching each image individually.
Multi-layer drop-shadow for premium icon appearance
A design system team wants the primary action icons to appear more physically present than secondary icons. They apply filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25)) drop-shadow(0 4px 10px rgba(0,0,0,0.12)) to the primary icon class, combining a tight definition shadow with a broader ambient shadow. The chained two-layer drop-shadow is applied once in a single CSS class and works correctly across all icon shapes in the system.
Pro tips
Get better results with these expert suggestions:
Use drop-shadow on SVG icon buttons for clear hover feedback
Adding transition: filter 0.15s ease to an SVG icon button and applying filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)) on :hover creates a shape-accurate shadow lift that reads as a physical press response. Because the shadow follows the icon path, it works correctly on any icon shape without needing to know the icon's bounding box dimensions.
Combine drop-shadow with a slight translate on hover for a lift effect
Pairing filter: drop-shadow(0 6px 8px rgba(0,0,0,0.25)) with transform: translateY(-2px) on :hover creates the impression of an icon physically lifting off the surface. The shadow deepens and the icon moves upward simultaneously, both applied via CSS transitions on the same element. This combination works naturally on any icon shape.
Chain two drop-shadows for ambient and direct shadow layers
A single drop-shadow produces a directional shadow. Chaining two: filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2)) drop-shadow(0 6px 12px rgba(0,0,0,0.1)) adds a close, sharp shadow for definition and a distant, diffuse shadow for ambient depth. The combination reads as physically realistic and is used in design systems for premium icon treatments.
Apply drop-shadow to an SVG sprite sheet container cautiously
If multiple SVG icons are grouped inside a single container element and filter: drop-shadow() is applied to the container, the shadow is generated from all icons combined as a flat bitmap, not individually per icon. This produces a correct result if icons do not overlap, but causes blended shadows if icons are adjacent. Apply drop-shadow directly to individual icon elements for per-icon shadow control.
Use drop-shadow for PNG logos on variable backgrounds
A PNG logo on a navigation bar that appears over both light and dark sections of a page needs a shape-following shadow to look correct. box-shadow would show a rectangular halo on the dark sections. filter: drop-shadow() with a subtle shadow follows the logo outline correctly regardless of the background.
Keep blur low for small icon drop-shadows
At 16px to 24px icon sizes, a blur radius of 1px to 3px is sufficient for a visible shadow. Larger blur values at small sizes produce muddy halos that obscure icon detail and can make icons harder to read against complex backgrounds.
drop-shadow() does not accept a spread value
Unlike box-shadow, the filter: drop-shadow() syntax does not include a spread radius parameter. If you need a wider shadow, increase blur radius and decrease opacity slightly. A fourth length value makes the whole filter declaration invalid, so the browser ignores it and no filter is applied.
Frequently asked questions
Related guides
More use-case guides for the same tool:
Related tools
Other tools you might find useful:
Ready to get started?
Open Filter Effects Builder to review its free limits and processing method.
Open Filter Effects Builder →Free tier · No account needed · Transparent limits