Skip to tool
ecech.
🎨 Design & Color

One Shadow Looks Like a Sticker, Two Look Like an Object

Real objects cast a tight contact shadow and a soft ambient one. Stack two box-shadow values and the result stops looking like CSS.

CSS



  
Advertisement

How the calculation works

What a real object does, and what one shadow does one shadow floats, edges unclear two shadows contact plus ambient A tight shadow at the base says where the object touches. A soft wide one says how far it sits from the surface.

How to Use This Tool

Adjust the layers and copy the CSS. Start from a preset if you want something that already looks right — each one is a real layered shadow rather than a single blur.

The four numbers

box-shadow: x y blur spread colour;

  • x and y — how far the shadow is offset. Almost always y only, because light comes from above in nearly every interface.
  • blur — how soft the edge is. Zero gives a hard-edged copy of the shape.
  • spread — grows or shrinks the shadow before blurring. This is the one nobody uses and it is the most useful.
  • colour — usually black at low opacity, and see below for why that is a compromise.

Spread, properly

A positive spread makes the shadow larger than the box in every direction; a negative one makes it smaller. Combine a negative spread with a large blur and you get a soft halo that hugs the shape without a visible edge — the look that reads as expensive, and one that blur alone cannot produce.

The other common use is a shadow with zero blur and a positive spread, which is a solid outline that follows the border radius. It is a useful focus ring and it does not affect layout the way a border does.

Same blur, three spreads spread 0 spread +6, larger spread −6, tighter halo
Negative spread with a large blur is how the soft, edgeless look is made.

Black is a compromise

A pure black shadow at low opacity greys out whatever is behind it, which is why shadows on coloured backgrounds often look muddy. A shadow is really an absence of light, so it should carry a hint of the surface colour — a slightly blue-tinted shadow on a blue-grey background reads as far more natural than a grey one.

Try setting the shadow colour to a very dark, very saturated version of your background hue rather than to black. The difference is small per element and noticeable across a whole interface.

Performance

  • Large blur radii are expensive to composite, particularly on many elements at once. A list of a hundred cards each with a 40-pixel blur is a measurable cost on lower-end devices.
  • Do not animate box-shadow. It triggers a repaint on every frame. The standard technique is to put the shadow on a pseudo-element and animate its opacity, which the compositor can handle without repainting.
  • Inset shadows draw inside the box and are useful for pressed states and inputs, where an outer shadow would look like the element is floating rather than recessed.
Advertisement

Frequently Asked Questions

Why do my CSS shadows look fake?
Usually because there is only one, with a large blur. Real objects cast two shadows at once — a small tight one where they touch the surface, and a larger soft one further out. Stacking two or three box-shadow values, separated by commas, is the whole difference.
What does spread do in box-shadow?
It grows or shrinks the shadow before the blur is applied. Positive spread makes it larger than the box in every direction; negative makes it smaller. A negative spread with a large blur gives a soft halo that hugs the shape, which blur alone cannot produce.
How do I add more than one shadow?
Separate them with commas in a single box-shadow declaration. They are drawn in order, with the first on top. That is how every layered shadow system works, including the ones in design frameworks.
Why do shadows look muddy on coloured backgrounds?
Because a pure black shadow greys out the colour behind it. A shadow is an absence of light rather than a layer of grey, so it looks more natural tinted toward the background hue — a dark saturated version of the surface colour rather than black.
Is box-shadow bad for performance?
Large blur radii cost real time to composite, especially across many elements. The bigger problem is animating box-shadow, which forces a repaint every frame — put the shadow on a pseudo-element and animate its opacity instead, which the compositor handles without repainting.
What is an inset shadow for?
Drawing the shadow inside the box rather than outside, which reads as recessed rather than raised. It is the right choice for pressed button states, text inputs and anything that should look set into the surface.

Related tools in Design & Color

Browse all Design & Color tools
A handwritten note reading ecech.com resting on the keyboard used to build the site.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.