Box Shadow vs Drop Shadow in CSS: What Actually Differs
Both add a shadow, both accept nearly identical values, and yet they behave completely differently the moment your element isn't a plain rectangle.
box-shadow and filter: drop-shadow() both draw a shadow behind an element with nearly the same syntax — offset-x, offset-y, blur, and a color. The difference only shows up once you look past a plain rectangle: one shadows the box, the other shadows the actual visible shape.
box-shadow shadows the element's box
box-shadow draws its shadow based on the element's border box — its rectangular bounding shape, including border-radius if set. If you apply box-shadow to a PNG icon with transparent corners, the shadow still renders as a rectangle behind the image, ignoring the transparent parts entirely, since box-shadow doesn't know or care what's actually visible inside the box.
Sponsored
drop-shadow follows the actual rendered shape
filter: drop-shadow() operates on the alpha channel of what's actually rendered — for an image with transparency, it shadows the visible (non-transparent) pixels, not the rectangular frame around them. A star-shaped PNG icon gets a star-shaped shadow with drop-shadow, but a rectangular one with box-shadow, because box-shadow can't see past the box.
Side-by-side comparison
- box-shadow — shadows the rectangular border box; supports inset shadows; supports multiple comma-separated shadows; well-supported and cheap to render.
- drop-shadow — shadows the actual rendered shape (respects transparency); no inset option; can be chained with other filters like blur() or brightness(); slightly more expensive to render, especially on large or animated elements.
A quick way to decide
Ask whether the element you're shadowing is effectively a rectangle (a card, a button, a modal) or has meaningful transparency in its shape (an icon, a logo, cutout artwork). Rectangle → box-shadow. Irregular shape with transparency → drop-shadow. Getting this backwards is the single most common cause of a shadow that looks visibly "off" without an obvious reason why.
Tools used in this article
Sponsored
Frequently asked questions
Yes — filter: drop-shadow() works on any element, but on a plain rectangular div it behaves almost identically to box-shadow (and costs more to render), so there's little reason to prefer it there.
TechToolsCenter Team
Product & Tools
The team behind TechToolsCenter — building fast, private, browser-based tools and writing practical guides on how to get the most out of them.
Related articles
CSS Grid vs Flexbox: When to Use Each (With Real Examples)
Both lay out elements without floats or absolute positioning, and both are genuinely production-ready today — the real question isn't which is 'better,' it's whether your layout is fundamentally one-dimensional or two.
Why Your SVG Files Are Bigger Than They Should Be
An SVG exported straight from your design tool is carrying editor metadata, unused definitions and absurd decimal precision — none of which affects how it looks.
How to Create a Favicon for Your Website (All Sizes, Free)
The small icon in a browser tab still matters for brand recognition and trust — here's how to generate every size you need, from a 16px tab icon to an Apple touch icon.