Stack multiple shadow layers for natural CSS box-shadows, with presets like neumorphism and brutalism plus a Tailwind class.
Presets
3 shadow layers
px
px
px
px
%
Stacking several faint layers looks more like real light. A deep tint that suits the background works better than pure black.
Related searches
Box Shadow Generator
box shadow generator css
html box shadow generator
online box shadow generator
css box shadow generator
Box Shadow Generator free
What is Box Shadow Generator?
Lets you adjust the position, blur and color of a box-shadow while watching the result, and generates the CSS code.
How to use
1
Adjust the horizontal and vertical position and the amount of blur.
2
Choose the shadow color and opacity.
3
Copy the CSS code.
Tips
A large blur with low opacity gives a soft shadow.
Layering several shadows looks much more natural.
Learn more
1How to read box-shadow values
box-shadow is written in the order horizontal offset, vertical offset, blur, spread and color. The larger the blur value, the softer the edge of the shadow, and adding inset makes it an inner shadow. Joining several with commas lets you layer shadows.
2Making natural-looking shadows
Use a color with lower opacity (for example 8–15%) rather than solid black, and layering a large shadow with a small one looks more natural. Increase the y value and the blur together according to how high the element appears to float.
3How a box-shadow value is built
The values go in order on a single line: "horizontal offset, vertical offset, blur, spread, color", and putting inset at the very front makes it an inner shadow. For example, 0 4px 12px 0 rgba(0,0,0,0.12) means the shadow drops 4px down, blurs out by 12px, and is black at 12% opacity.
Spread is a value that grows or shrinks the size of the shadow itself. A negative value makes the shadow smaller than the box, giving a soft effect that sits only along the bottom. To use several shadows, join them with commas.
4Layering shadows looks more natural
Real shadows are dark and sharp close to an object and lighter and more spread out the farther away they are. A single layer looks off, but stacking two or three gets close. For example, stack them while growing the offset and blur, like 0 1px 2px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.06), 0 12px 24px rgba(0,0,0,0.08).
Using a dark tone close to the background color instead of pure black makes it softer. A deep navy shadow blends naturally over a blue background, and a brownish shadow over a beige one.
5box-shadow, drop-shadow and performance
box-shadow draws the shadow along the rectangular border of an element. If you want a shadow that follows the actual shape, such as a PNG or SVG with transparent areas, you need filter: drop-shadow(). However, drop-shadow costs more to render, so using it a lot on screen can make scrolling feel heavy.
The larger the blur value and the more layers you stack, the more work it takes to draw. Instead of putting big shadows on hundreds of list items at once, you can keep things smooth by growing them only on hover or using them only on important cards. On a dark background shadows are hard to see, so combining them with a border or a light outline also works.
6What values should I start with for a card shadow?
A small vertical offset, a blur of 2–3 times the offset, and an opacity of around 5–15% look natural in most cases.
The higher the elevation, the farther the shadow spreads and the lighter it gets. Below are common starting points by level. Adjust the values bit by bit with the sliders to fit your design.
Very low
Example value
0 1px 2px rgba(0,0,0,0.08)
Used for
A thin outline used instead of a divider
Low
Example value
0 2px 6px rgba(0,0,0,0.10)
Used for
Regular cards, input fields
Medium
Example value
0 6px 16px rgba(0,0,0,0.12)
Used for
Hovered cards, dropdowns
High
Example value
0 16px 40px rgba(0,0,0,0.16)
Used for
Modals, popovers
Level
Example value
Used for
Very low
0 1px 2px rgba(0,0,0,0.08)
A thin outline used instead of a divider
Low
0 2px 6px rgba(0,0,0,0.10)
Regular cards, input fields
Medium
0 6px 16px rgba(0,0,0,0.12)
Hovered cards, dropdowns
High
0 16px 40px rgba(0,0,0,0.16)
Modals, popovers
7Does the shadow color have to be black?
Using a dark color that matches the background instead of black looks much more natural and refined.
For an element on a blue background, that means a dark navy with low opacity. A pure black shadow tends to look muddy and heavy on a colored background.
Pick a color in the shadow color picker, then set the density with the opacity slider.
8When do I use an inner shadow (inset)?
Use it to give a recessed feel, like a pressed button or a carved-in input field.
Turn on the inner shadow checkbox and the same values are drawn inside the element. When a button is pressed, reducing the outer shadow and adding an inner one brings out the pressed feel.
You can also layer an outer shadow and an inner shadow together. Create them with add layer, then set inner or not separately for each layer.
9How do I put a shadow on only one side?
Set the spread to a negative value and the shadow shrinks, so it shows only on the side you offset toward.
For example, writing 0 10px 10px -10px shows the shadow on the bottom only. The trick is to match the negative spread to the blur size.
It fits when you want to emphasize just one direction, like a thin shadow under a scrolling header or the lower edge of a tab.
The spread range is -100 to 100 px. A small negative number is usually enough for a one-sided shadow.
10What's good about stacking shadows in several layers?
Stacking several faint shadows looks much more three-dimensional, like real light: dark close up and soft farther away.
The typical approach is to press add layer, then double the offset and blur for each layer while keeping the opacity low. Spacing them out like 1px, 2px, 4px and 8px gives a natural gradient shadow.
In code they're joined by commas, and the shadow written first is drawn on top. It's easy to copy a layer with the duplicate button and tweak just the values.
11How do I make a shadow grow on hover?
Create two shadow values, one for the default state and one for hover, and add a transition for a smooth change.
Make a low one and a high one in this tool and copy each. Then give the element transition: box-shadow 0.2s, transform 0.2s, and use the high shadow with translateY(-2px) on hover, and the card seems to lift slightly.
Animating shadows directly can raise the cost of repainting. If a list has many cards, it's better to use the effect on only some elements.
12Why can't I see the shadow in dark mode?
On a dark background, black shadows are barely visible, so you need to express elevation another way.
The higher the element, the slightly lighter a surface color than the background you use, to give a floating feel.
Add a thin light border, about 1 px, to bring out the outline.
Lay the shadow in subtly by raising the opacity and increasing the blur.
Set separate shadow values for light mode and dark mode.
13Why does the shadow look cut off or not show?
If a parent element has overflow: hidden, a shadow that spreads outside gets clipped.
Give the parent padding equal to how far the shadow spreads, or change overflow to something other than hidden. Inside a scrolling area, shadows on edge elements are often clipped, so leave room inside.
Also, if the element's background is transparent, the shadow shows behind the element too, which can look odd. Set a box color to check.
14How do I use the code I made in Tailwind?
Replace the spaces with underscores and put it inside shadow-[...].
For example, 0 6px 16px rgba(0,0,0,0.12) becomes shadow-[0_6px_16px_rgba(0,0,0,0.12)]. For several layers, join them with commas inside the same brackets.
For values you use often, naming them in the boxShadow theme in your config file lets you use the same shadow across the whole project.
15How do I make a neumorphism-style shadow, and what should I watch out for?
Give an element the same color as the background a pair of shadows, one dark and one light, in opposite directions, and it looks softly raised.
For example, layer a dark shadow toward the bottom right and a white shadow toward the top left at the same size. In this tool, create two layers and just flip the sign of the offsets.
However, the element edges are blurry, so it's hard to tell it's a button, and the low contrast hurts accessibility. For important controls, use a border or color contrast as well.
16Can I make a border or focus ring with a shadow?
Set the offset and blur to 0 and use only spread, and it looks like a border around the outside of the element.
0 0 0 1px rgba(0,0,0,0.1) looks like a 1px line, and 0 0 0 3px rgba(99,102,241,0.4) looks like the focus ring used when an input is selected. Unlike a border, it has the advantage of not changing the element's size or layout.
In this tool, set the horizontal and vertical offsets and blur to 0 and check by raising only the spread slider.
17How do I make a glow effect where light bleeds out?
Set the offset to 0, make the blur large and the color vivid, and you get a glow effect with light spreading around the element.
For example, writing 0 0 24px rgba(99,102,241,0.6) spreads a soft purple light. One layer is flat, so stacking a small, strong layer with a large, faint one makes it more three-dimensional.
It works best on a dark background. On a light background the glow can look muddy, so lower the opacity.
18How do I make a button that looks three-dimensional?
With a blur of 0, only a vertical offset and a dark color, the button looks like it has thickness underneath.
Write something like 0 4px 0 #4338ca and, when pressed, reduce the offset to 2px while moving the button down 2px, and it feels like it's really being pressed. A blur of 0 renders it like a sharp surface.
It suits a game-like or playful service, while a soft shadow fits a calmer one better.
19How do I keep shadows consistent across a whole service?
Define 3–4 shadow levels, name them, and use only those values on every screen to get consistency.
Create three levels by element elevation: low, medium and high.
Save them as CSS variables with names like --shadow-sm, --shadow-md and --shadow-lg.
Use one shadow color and change only the opacity by level.
When cards, modals and dropdowns overlap, make the element on top use the higher level.
When building a new element, pick from the existing levels instead of making up a new value.
It's easy to start from this tool's presets, fine-tune with the sliders and then move the values into named variables.
20Why do I set a box color and a background color?
A shadow looks different depending on the background, so it's only accurate if you enter the colors you'll actually use and check.
A shadow that looks nice on white may be invisible or too strong on a gray or colored background. Change the preview's background and box color to the values you'll really use, and adjust the shadow.
If the card is the same color as the background, the shadow alone has to set the element apart, so you may need slightly higher opacity.
21How do box-shadow and text-shadow differ?
box-shadow puts a shadow on the box shape, while text-shadow follows the shape of the letters.
box-shadow
Target
The element's box area
Spread
Available
Inner shadow
Possible with inset
text-shadow
Target
Letter shapes
Spread
None
Inner shadow
None
Property
Target
Spread
Inner shadow
box-shadow
The element's box area
Available
Possible with inset
text-shadow
Letter shapes
None
None
To put a shadow along an image's outline, use the filter drop-shadow.
22How many layers are appropriate when stacking shadows?
Two or three layers are enough for regular elements like cards, and it's best not to go past five.
The more layers, the longer and harder to read the code gets. Start with something like one small shadow and one large one, plus a medium one if needed.
If it's hard to remember layers by name, arrange them by layer number from the closest shadow to the farthest.
23How do I manage a shadow used repeatedly on many elements?
Don't copy the same shadow in many places: define it once as a CSS variable or class and call it where needed.
When you later want a slightly lighter shadow, you only have to fix one place, and it also prevents subtly different shadows from mixing across screens.