CSS Box Shadow Generator
Create and customize CSS box shadows with real-time preview
Shadow Preview
Live preview of your box shadow
Box Properties
Customize the box appearance
Shadow Layers
Shadow 1
Preset Shadows
Quick shadow presets to get started
Category Hub
Category Essentials
Developer tool searches often overlap across formatting, validation, and quick code generation. These links surface the strongest utility pages first so users can continue the workflow in one section.
Related Tools
Daily Inspiration
The pen is mightier than the sword. - Edward Bulwer-Lytton
CSS Box Shadow Generator - Create Box-Shadow CSS Online
Generate a CSS Box Shadow
We created this tool so you can generate box-shadow CSS code quickly and easily. By adjusting simple controls for offsets, blur, spread, and color, you can design everything from subtle card elevation to complex, layered shadows. This visual generator removes the guesswork, letting you perfect your design before copying the code.
*(Tool Interface Placeholder)*
- Preview: Live Preview Box
- Controls: Horizontal Offset Vertical Offset Blur Radius Spread Radius Color/Opacity Picker
- Toggles: Inset Shadow
- Output: Copy CSS
What is box-shadow in CSS?
The box-shadow property in CSS adds shadow effects around an element's frame. It's a versatile tool that can simulate depth, create glows, or define inset effects. We can even layer multiple shadows on a single element by separating each declaration with a comma, unlocking advanced styles like neumorphism.
Box-shadow syntax (quick reference)
The property follows a clear structure. We've broken it down for you.
Canonical template: box-shadow: offset-x offset-y blur-radius spread-radius color;
To create an inner shadow, you just add the inset keyword. For multiple shadows, simply list them, separated by commas.
What each value does
- offset-x / offset-y: These values control the shadow's position. A positive
offset-xmoves it right, while a positiveoffset-ymoves it down. - blur radius: This dictates how soft the shadow's edges are. A larger number creates a softer, more diffused look.
- spread radius: This value grows or shrinks the shadow. A positive number makes it larger, while a negative number makes it smaller.
- inset: Adding this keyword moves the shadow from the outside of the element's frame to the inside.
Common shadow recipes
Here are a few popular shadow styles you can create with our tool. Use these as a starting point for your own designs.
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
box-shadow: 8px 8px 16px #d1d9e6, -8px -8px 16px #ffffff;
box-shadow: 0 0 20px rgba(0, 119, 255, 0.5);
- Card Elevation: A soft, subtle shadow perfect for making UI cards feel like they are floating.
- Button Hover: A slightly stronger shadow to give users clear feedback when they interact with a button.
- Neumorphism Style: This popular effect uses two shadows (one light, one dark) to create a soft, extruded look.
- Glow Effect: A colored shadow with a large blur radius can create a beautiful glow around an element.
Box-shadow vs drop-shadow()
It's important to choose the right tool for the job. While box-shadow is incredibly powerful, it has one key limitation: it only follows the shape of the rectangular box.
- Use
box-shadowfor rectangular elements like buttons, divs, and cards. - Use
filter: drop-shadow()when you need a shadow that follows the exact shape of a transparent PNG or an SVG icon.
Browser compatibility & prefixes
The box-shadow property has excellent support across all modern browsers, including Chrome, Firefox, Safari, and Edge. We generate clean, unprefixed code because prefixes like -webkit- or -moz- are no longer necessary for this feature in modern development.
Troubleshooting
My shadow is cut off. This usually happens when a parent container has overflow: hidden set. The shadow is part of the element's box, but it renders outside its boundary, so it can be clipped. Try adding some margin or padding around the element.
My shadow isn't visible. Check a few things: the shadow color might be too transparent, the blur radius could be too small, or the shadow color might be the same as the background color.
The rounded corners don't match. The box-shadow property automatically follows the border-radius of its element. If they seem mismatched, double-check that you have applied border-radius to the element itself.
I need a shadow around an SVG logo. For this, you should use filter: drop-shadow() instead. It traces the visible parts of the image, not its rectangular container.
The animations are laggy. Animating box-shadow can be performance-intensive, especially with large blur values or multiple layers. For smoother animations, we recommend animating transform and opacity on a pseudo-element instead.
Frequently Asked Questions
What does each number in box-shadow mean?
The first two numbers are the horizontal and vertical offsets (X and Y). The third is the blur radius, and the fourth is the spread radius.
How do I make an inset (inner) shadow?
Simply add the inset keyword to your box-shadow declaration. Our generator has a toggle for this.
How do I add multiple shadows to one element?
You can list multiple shadow declarations on the same property, separated by a comma. The first shadow in the list will be the topmost layer.
Does box-shadow respect border-radius?
Yes. The shadow's shape will curve to match the border-radius of the element it's applied to.
What's the difference between box-shadow and drop-shadow()?
box-shadow creates a shadow around an element's rectangular box. filter: drop-shadow() creates a shadow that follows the contours of an image's content (like a transparent PNG or SVG).
Why is my shadow clipped or cut off?
This is most often caused by an ancestor element having overflow: hidden, which cuts off anything rendered outside its box.
How do I create a "card" shadow like Tailwind/Bootstrap?
You can create this by using a small vertical offset (like 4px), a moderate blur (like 6px), and a semi-transparent black color (like rgba(0,0,0,0.1)).
Do I still need -webkit- / -moz- prefixes?
No. box-shadow is fully supported in all modern browsers, so vendor prefixes are no longer needed.
Are multiple/layered shadows bad for performance?
They can be, especially if animated. A few static, layered shadows are generally fine, but animating multiple complex shadows can strain the browser's rendering engine.
Related Tools:
- CSS Gradient Generator - Create beautiful backgrounds to complement your shadows.
- Border Radius Generator - Round the corners of your elements.
- CSS Minifier - Optimize your CSS files for production.
- Color Converter - Convert between HEX, RGB, and HSL color formats.
