CSS Shadow Generator

Generate CSS box-shadow code visually.

Save

Calculator

Inputs

Move the shadow right or left.

px

Move the shadow down or up.

px

Higher values make the edge softer.

px

Live output

Results

CSS Code
box-shadow: 10px 10px 20px 0px rgba(0,0,0,0.2);

Report

Export and share

Document

Copy and share

Assumptions

  • The generator outputs a single outer `box-shadow` declaration rather than layered or inset shadows.
  • Shadow color is currently modeled as black with adjustable opacity for a practical default.
  • Values are expressed in pixels, which matches most quick CSS prototyping workflows.

Sensitivity preview

No numeric sensitivity scenarios are available.

Related Tools

View All

About this Box Shadow Gen

CSS Box Shadows add depth and elevation to web elements. However, writing the `box-shadow` property by hand involves guessing 4 different numeric values and a color. This generator lets you tweak the values visually and copy the perfect code.

Who this calculator is for

  • UI designers and frontend developers polishing cards, buttons, modals, and navigation surfaces.
  • Teams translating visual specs into CSS without trial-and-error in browser devtools.
  • Anyone building design systems and wanting reusable shadow values for multiple components.

When to use it

  • Prototype a subtle card shadow for a dashboard or landing page component.
  • Compare blur, spread, and offset combinations before hard-coding a design token.
  • Generate a starting CSS snippet for hover states or elevated surfaces.

How to use this calculator

  1. Adjust the X and Y Offsets to move the shadow.
  2. Increase Blur Radius for softer shadows.
  3. Use Spread to change the size of the shadow.
  4. Lower the Opacity for a more subtle, realistic look.

Key assumptions

  • The generator outputs a single outer `box-shadow` declaration rather than layered or inset shadows.
  • Shadow color is currently modeled as black with adjustable opacity for a practical default.
  • Values are expressed in pixels, which matches most quick CSS prototyping workflows.

Accuracy and testing

Review formula sources, default test cases, assumptions, unit handling, rounding rules, and changelog for this calculator.

View accuracy page

How this calculator works

The tool generates a CSS string: `box-shadow: [X]px [Y]px [Blur]px [Spread]px rgba(0,0,0, [Opacity]);`

Key Features

  • Visual Preview
  • Instant CSS Code
  • RGBA Color Logic

Tips & Best Practices

  • For modern 'flat' design, use a large blur radius, zero spread, and very low opacity (e.g., 0.1).
  • Avoid pure black shadows (#000000). Use dark grays or tints of your primary color for a more natural look.

Frequently Asked Questions

What do the 4 numbers in box-shadow mean?
They represent: X-offset (horizontal position), Y-offset (vertical position), Blur Radius (softness), and Spread Radius (size). A 5th value defines the color.
How do I make the shadow look realistic?
Use a larger Blur Radius and lower Opacity. Real shadows are rarely jet black or sharp; they are soft gradients caused by ambient light.
Does box-shadow affect page performance?
Yes, heavy use of large blur radii or multiple shadows can impact rendering performance, especially on mobile devices or during animations.
Can I have multiple shadows on one element?
Yes, you can comma-separate multiple shadow values in the CSS property (e.g., `box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);`).
What is an 'Inset' shadow?
An inset shadow is drawn inside the border of the element (making it look depressed/concave) rather than outside (making it look elevated/convex).