Box Shadow CSS Generator

Fast, accurate and free online box shadow css generator tool running directly in your browser.

No account
No installation
Free
Instructions
  • 1
    Enter data
    Enter content, paste text or load a file from disk.
  • 2
    Click the button
    The tool will immediately process your data in the browser.
  • 3
    Get the result
    Copy the finished text or save the file to your device.
function runTool() {
  return "Result ready in 0.1s";
}

CSS Shadow Generator

Create professional box-shadow effects layer by layer.

Ready style

Warstwy (2)

Warstwa #1
0px
4px
14px
0px
10%
Warstwa #2
0px
1px
3px
0px
5%

Live preview

12px

Kod CSS

box-shadow: 0px 4px 14px 0px rgba(0, 0, 0, 0.1), 0px 1px 3px 0px rgba(0, 0, 0, 0.05);

Rate this tool:

Related tools

Other tools you may find useful

Pass it on

Will someone else find this useful?

Send a friend the link. It opens right away, with no account and no fees.

CSS box-shadow generator - layers, presets, insets and depth systems

The tool generates multi-layer shadows for any CSS elements. You will set the offsets, blur, spread, color, opacity and inset flag. You will receive clean code with the option of legacy prefixes and live preview. Additionally, you will find practical recipes, depth systems and tricks that will speed up your work in future projects.

In the panel you can set the preview background, fillet radius and shadow layers. Each layer has parameters:x, y, blur, spread, color, alphaand switchinset. The order of the layers matters. Later layers render on top of earlier ones.

How the box-shadow CSS Generator works

The engine composes the value ofbox-shadowfrom a list of layers separated by commas. Each layer has the form[inset] offset-x offset-y blur spread color. Color is written asrgba()to maintain control over opacity. For full compatibility, you can enablelegacy, which adds the lines-webkit-box-shadow i -moz-box-shadow.

Parameters and effects on the effect

Layer components

  • x- horizontal shift. Positive values ​​cast a shadow to the right.
  • y- vertical shift. Positive values ​​cast a shadow downwards.
  • blur- blur radius. The bigger it is, the softer the shadow.
  • spread- expanding the shadow patch. Positive widens, negative narrows.
  • color i a- shadow color and opacity in percent.
  • inset- moves the shadow inside the element, giving a concave effect.

Global settings

  • bg- element background with shadow. It has a large impact on the perception of contrast.
  • radius- rounding radius. Match the style of tabs and buttons.
  • legacy- additional prefixes for older browser engines.

Presets and applications

Preset Layers Application
soft two soft layers with a small blur and a larger blur UI tabs, lists, settings panel
hard shorter, more contrast layer over softer action buttons, compact elements
inset single inner layer input fields, concave panels, emboss style

Pre-built code examples

1. Soft shadow for cards

.card-soft {
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 3px 6px 0 rgba(0,0,0,.20),
    0 10px 20px 0 rgba(0,0,0,.15);
}

2. Contrasting shadow for buttons

.btn-hard {
  border-radius: 12px;
  box-shadow:
    0 6px 10px 0 rgba(0,0,0,.35),
    0 2px 4px 0 rgba(0,0,0,.20);
}

3. Inner box shadow

.input-inset {
  background: #fff;
  border-radius: 10px;
  box-shadow: inset 0 2px 6px 0 rgba(0,0,0,.25);
}

4. Elevation system based on variables

:root{
  --e1: 0 1px 2px rgba(0,0,0,.10);
  --e2: 0 2px 6px rgba(0,0,0,.14);
  --e3: 0 6px 16px rgba(0,0,0,.16);
  --e4: 0 10px 24px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.10);
}
.e-1{ box-shadow: var(--e1); }
.e-2{ box-shadow: var(--e2); }
.e-3{ box-shadow: var(--e3); }
.e-4{ box-shadow: var(--e4); }

Mature shading strategies

  • Contact layer - a short shadow with a small blur close to the element simulates contact with the surface.
  • Diffuse layer - a second layer with a larger blur creates the impression of distance from the background.
  • Contrast and background - on a light background use grays with an alpha of 10–22; on a dark one increase the alpha or use a light shadow
  • Design consistency - define 3–5 elevation levels and use them consistently.
  • Be careful with spread - large values quickly look artificial. Blur is usually enough.

Performance and accessibility

Box-shadow is rendered in the compositor. Single layers are cheap, but large blurs on many elements can strain weaker devices. Avoid animating high blur values. If the effect is purely decorative, do not apply it in long scrolling lists. For clickable elements, keep a clear focus ring that is independent of the shadow.

Recipes for later

Soft neumorphism with a double pair of shadows

.neu {
  background: #e9eef6;
  border-radius: 20px;
  box-shadow:
    10px 10px 20px rgba(0,0,0,.12),
    -10px -10px 20px rgba(255,255,255,.85);
}
  

Card with a focus ring and a base shadow

.card-focus {
  border-radius: 16px; background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.card-focus:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(59,130,246,.35),
    0 8px 20px rgba(0,0,0,.18);
}
  

Inner glow as a soft outline

.inner-glow {
  background: #111827; border-radius: 14px;
  box-shadow: inset 0 0 12px 4px rgba(59,130,246,.25);
}
  

Flat card with a subtle blur

.card-flat { box-shadow: 0 1px 4px rgba(0,0,0,.12); }
  

Hover shadow in an elevation system

.tile { box-shadow: var(--e2); transition: box-shadow .18s ease, transform .18s ease; }
.tile:hover { box-shadow: var(--e3); transform: translateY(-2px); }
.tile:active { box-shadow: var(--e2); transform: translateY(0); }
  

Mixing box-shadow with other techniques

Drop-shadow via filter

The drop-shadow() filter shades the outline of the rendered shape (e.g. PNG, SVG). It works well for icons with transparency.

.icon { filter: drop-shadow(0 6px 14px rgba(0,0,0,.22)); }
      

Layers with ::before

When you want different shadows depending on the state, use pseudo-elements to separate responsibilities.

.card-multi { position: relative; }
.card-multi::before{
  content:""; position:absolute; inset:0; border-radius:inherit;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
      

Choosing shadow colors

Neutral grays with low alpha look the most natural. For brand accents you can slightly tint the shadow with your main color. Avoid pure black 0,0,0 at alpha 1. In production UIs, the 0.10–0.25 range works best.

  • On a light background: rgba(0,0,0,.12) to rgba(0,0,0,.20).
  • On a dark background: rgba(0,0,0,.30) to rgba(0,0,0,.45) or a light shadow rgba(255,255,255,.12).
  • For neon effects and promotional cards, add a slight tint of the brand color.

Diagnostics and quick fixes

  • Dirty outline - reduce spread to 0 and slightly increase blur.
  • Lift effect too strong - lower the y and blur of the top layer.
  • Flat look - add a short contact layer 0 1px 2px.
  • Card too dark - reduce alpha from 0.22 to about 0.16 and lighten the card background.

How to plug in the generated CSS

  1. Add the target class to the element, e.g. .card or .panel.
  2. Click Generate and copy the value from the CSS panel.
  3. Paste it into your stylesheet. If the project supports variables, move repeated shadows to :root.
  4. Check the effect on different backgrounds and in dark mode. If necessary, prepare alternative shadow sets.

Implementation checklist

  • The elevation scale has a maximum of 5 levels and is consistent throughout the project.
  • The focus ring does not get lost in the shadow and is visible for keyboard users.
  • You do not animate large blur values on many elements at once.
  • Spread is used sparingly. The main work is done by blur and y.

Summary

The CSS box-shadow generator lets you create production-quality shadows quickly and predictably. Instead of composing values by hand, you arrange layers, choose a preset and copy the result. Use an elevation system, control contrast and test on the target backgrounds. This way your UI looks professional, stays readable and runs smoothly.

Install Webp.pl Have the tools in your own pocket!