Free · Fast · Privacy-first

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. 1. drop-shadow()
    px
    px
    px
.image {
  filter: drop-shadow(6px 8px 10px rgba(0, 0, 0, 0.35));
}
Sample
Original
Sample cut-out character with a transparent background
Filtered
Sample cut-out character with a transparent background

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
IframeResponsiveAttribution included

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. 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. 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. 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. 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:

1

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.

2

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.

3

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.

4

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.

5

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.

6

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.

7

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.

FAQ

Frequently asked questions

box-shadow applies a shadow to the rectangular CSS box model of an element, always producing a rectangular shadow that follows the border radius and never the visible content inside. filter: drop-shadow() processes the composited pixel output of the element and generates a shadow from the non transparent pixels, following the actual visible shape outline regardless of how the underlying layout box is shaped. For PNG icons, SVG paths, illustrated badges, and other non rectangular content, drop-shadow() produces the correct shape accurate shadow where box-shadow would produce a rectangular artefact that visibly misrepresents the element. The two properties are not interchangeable, and the right choice depends entirely on whether the visual content fills its box or not.
No. Unlike box-shadow, which accepts an optional spread radius as the fourth length value, filter: drop-shadow() only accepts three length values: horizontal offset, vertical offset, and blur radius, followed by a colour. There is no spread parameter. Adding a fourth length value is a common error when copying from box-shadow syntax; the extra length makes the declaration invalid, so the browser drops the whole filter and no shadow appears.
Yes. Multiple drop-shadow() functions are chained within the same filter property value, separated by spaces: filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3)) drop-shadow(-1px -1px 3px rgba(0,0,0,0.1)). This differs from box-shadow, which separates multiple shadows with commas. The filter property never uses commas between functions: a comma makes the whole declaration invalid.
Use box-shadow when the element is rectangular (a card, button, panel, or div without transparency) and you want control over spread radius, which is not available in drop-shadow(). box-shadow is also more efficient on large rectangular elements because it does not require alpha channel tracing. Use filter: drop-shadow() specifically when the element has transparent areas that must not be shadowed, such as PNG icons, SVG illustrations, and cutout product photographs.
Yes. filter: drop-shadow() traces the rendered pixel output of the element, including SVG paths, fills, strokes, and gradient definitions inside the SVG. For an SVG with a complex illustrated shape, the shadow follows the outer boundary of all visible SVG content as if it were a single composited bitmap, including any compound paths or grouped elements. For inline SVGs declared directly in the HTML, the shadow traces the combined visual outline of every visible path. For img embedded SVGs referenced through a src attribute, the shadow traces the rendered SVG output within the image element box. The same applies to symbol references resolved through use elements, which produce a unified shadow around the rendered final shape rather than each component piece.
Yes. filter: drop-shadow() is supported in all modern browsers including Chrome, Firefox, Safari, and Edge without vendor prefixes. It is part of the CSS filter specification that has been broadly supported since 2016. Internet Explorer does not support the CSS filter property, but IE is not a target for new development. The -webkit-filter prefix was required for very early WebKit versions but is no longer necessary.
Yes. Adding transition: filter 0.15s ease to the element and changing the drop-shadow values on :hover produces a smooth shadow animation. Starting from filter: none works: the Filter Effects specification defines how none interpolates with a filter list, and Chromium animates it smoothly. When the hover state chains several functions, give both states the same functions in the same order so each one interpolates on its own.
No. Like all CSS filter effects, filter: drop-shadow() is a visual rendering effect that does not affect document flow, element dimensions, or sibling layout positions. The shadow rendered around an irregular shape does not create additional spacing in the layout box, and adjacent elements remain unaware of the shadow extent. If the shadow extends beyond the element bounding box and is clipped by a parent with overflow: hidden, add overflow: visible to the parent or add explicit padding to provide space for the shadow to render without clipping. The same clipping concern applies to flex and grid containers with constrained dimensions, and to elements with border-radius that visually cut into the shadow without changing the layout footprint at all.
Set the shadow colour to a saturated brand or accent value at moderate alpha and use a zero horizontal and vertical offset combined with a generous blur radius. For example filter: drop-shadow(0 0 12px rgba(80, 200, 255, 0.55)) produces a soft cyan glow that wraps the visible shape on a dark background. Layer two drop-shadow calls if you want a tighter inner glow combined with a wider ambient halo, as in filter: drop-shadow(0 0 4px rgba(80, 200, 255, 0.7)) drop-shadow(0 0 14px rgba(80, 200, 255, 0.35)). For animated states such as :hover or :focus, transition the filter property over 0.2s ease so the glow fades in smoothly rather than appearing as a sudden jump.

Related guides

More use-case guides for the same tool:

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