What is a box shadow generator?
A box shadow generator builds a CSS box-shadow from five numbers and a colour, and shows you the result. You set the horizontal offset, the vertical offset, the blur, the spread, and the shadow colour, and it gives you the CSS string, 4px 4px 12px 0px #000000, plus a live preview box wearing the shadow. Copy the string into a stylesheet and any element gets the same shadow.
The default on this page is 4px 4px 12px 0px #000000: the shadow sits 4 pixels to the right and 4 pixels down, blurs over 12 pixels, does not spread, and is black. The full CSS is box-shadow: 4px 4px 12px 0px #000000. It is a small, soft shadow, the kind most cards and buttons use.
Shadows are how flat design creates depth. A card with a shadow looks raised above the page; a button with a shadow looks pressable; a modal with a big soft shadow looks like it floats. Without shadows, every element sits on the same plane, and the page looks flat and hard to read.
Everything runs in your browser. The numbers you type never leave your device, and there is no account to create. The preview updates with every keystroke, so you can tune the shadow until the box looks right.
How a CSS box shadow works
A box shadow has four lengths and a colour, in a fixed order: horizontal offset, vertical offset, blur radius, spread radius, then the colour. The offsets move the shadow away from the element: positive X moves it right, positive Y moves it down, negative values move it left and up. The default offsets of 4 and 4 put the shadow down and to the right, as if the light came from the top left.
The blur radius controls how soft the shadow is. A blur of 0 gives a hard edge, a sharp copy of the element offset by the offsets. A blur of 12 spreads the shadow over 12 pixels, fading from dark at the edge to transparent. Larger blurs make softer, more distant-looking shadows; smaller blurs make harder, closer-looking ones.
The spread radius controls how big the shadow is. A spread of 0 makes the shadow the same size as the element. A positive spread grows it in every direction, so a spread of 10 makes the shadow 10 pixels bigger on all sides. A negative spread shrinks it, so a spread of minus 10 makes the shadow 10 pixels smaller on all sides, which is useful for inner-looking shadows.
The colour is usually black, and the shadow is usually softened by making it transparent, with rgba(0, 0, 0, 0.15) instead of #000000. This generator uses hex colours only, so it cannot set transparency directly. If you want a softer shadow, take the CSS it gives you and replace the hex colour with an rgba colour at low opacity, which is the standard trick.
The four numbers, and what each one does
The horizontal offset is the easiest to see. Set it to 20 and the shadow slides 20 pixels to the right of the box, leaving a gap on the left. Set it to minus 20 and it slides left. Most shadows use a small positive X, between 0 and 8, because the light in most designs comes from the top left, and the shadow falls down and right.
The vertical offset does the same thing downwards. A Y of 8 with a blur of 24 is the classic card shadow: the card looks raised, and the shadow pools underneath it. A Y of 0 with a blur of 12 gives a shadow on all sides, which suits an element that floats rather than sits. A negative Y puts the shadow above the element, which looks wrong unless the light really does come from below.
The blur is what makes a shadow look real. Real shadows are never hard-edged, because light is not a point. A blur of 0 looks like a copy of the element, not a shadow. A blur of 12 looks like a shadow cast by a nearby light. A blur of 40 looks like a shadow cast by a distant light, soft and spread out. The default blur of 12 is the middle of that range.
The spread is the least used of the four, and the most powerful. A positive spread makes the shadow bigger than the element, which reads as a glow or a halo. A negative spread makes it smaller, which reads as a shadow tucked under the element. Most card shadows use a spread of 0, and the spread is adjusted only when the shadow needs to be bigger or smaller than the element itself.
A worked example: three shadows, three looks
First, the default: offset X 4, offset Y 4, blur 12, spread 0, colour #000000 gives 4px 4px 12px 0px #000000, and the full CSS is box-shadow: 4px 4px 12px 0px #000000. It is a small, soft shadow, the kind a card or a button uses. The shadow is offset just enough to read as depth, and blurred just enough to look soft.
Second, no shadow at all: offset X 0, offset Y 0, blur 0, spread 0, colour #000000 gives 0px 0px 0px 0px #000000. Every length is zero, so the shadow sits exactly behind the element and is invisible. It is the baseline: any shadow is measured against no shadow, and this is what no shadow looks like in CSS.
Third, a coloured shadow above and to the left: offset X minus 8, offset Y minus 8, blur 20, spread 0, colour #FF5733 gives -8px -8px 20px 0px #FF5733. The shadow is orange-red, offset up and left, and blurred over 20 pixels, so it looks like a soft orange glow behind the top-left corner. Negative offsets are rare, and they are useful exactly when the design wants a shadow that breaks the usual down-and-right rule.
One more, to show the spread: offset X 0, offset Y 8, blur 24, spread 4, colour #000000 gives 0px 8px 24px 4px #000000. The shadow is directly below the element, blurred over 24 pixels, and grown by 4 pixels on every side, so it is bigger than the element and pools underneath it. That is the deep card shadow, the one modals and floating panels use.
Who uses a box shadow generator, and why
Web developers use it every time a design calls for a shadow. The design file shows a card with a soft shadow, and the developer needs the exact CSS. The generator produces it, with the preview confirming the look, and the string goes straight into the stylesheet.
Designers use it to test a shadow before committing to it. A shadow that looks good in a design tool can look too strong or too weak on a real page, because the tool and the browser render blur differently. The preview here is the browser rendering, so what you see is what the page will show.
Content creators use it for cards, buttons, and banners. A button with a shadow looks pressable, and a card with a shadow looks raised, and both are easier to use than their flat versions. The generator is the fastest way to get from a flat design to a design with depth.
App developers use it for the same reason in web views and hybrid apps. A image border tool frames a picture, and an image round corners tool rounds its corners; the shadow is the third piece of the same job, and it is what makes the framed, rounded picture look like it sits on the page rather than in it.
Box shadow vs border
A box shadow and a border both outline an element, but they do different jobs. A border is a line drawn on the edge of the element, in a colour and a width you choose. A shadow is a copy of the element, offset and blurred, drawn behind it. The border is part of the element; the shadow is behind it.
The practical difference is space. A border takes up space: a 2-pixel border makes the element 2 pixels bigger on each side, and the layout shifts. A shadow takes up no space at all: it is painted outside the element, and the layout does not move. That is why shadows are safer for hover effects, where a border appearing on hover would push the content around.
The other difference is softness. A border is always a hard line, however thin. A shadow can be blurred, so it fades into the background instead of stopping at a line. That softness is what makes a shadow look like depth and a border look like a frame. Use a border when you want a frame, and a shadow when you want depth.
In practice, the two are often used together: a 1-pixel border in a light grey, plus a soft shadow underneath. The border defines the edge, and the shadow gives the depth. A SCSS calculator helps when the same shadow has to be reused across a stylesheet with variables, so it is defined once and used everywhere.
Common box shadow mistakes
The first mistake is a shadow that is too strong. A black shadow at full opacity looks like a hole in the page, not like depth. Real shadows are soft and light, which is why most design systems use black at 10 to 20 percent opacity, not full black. This generator uses hex colours, so take its CSS and replace the hex with an rgba colour at low opacity for the real thing.
The second mistake is a blur of zero. A hard-edged shadow looks like a copy of the element, not a shadow, and it reads as a mistake. Even a small blur of 4 pixels softens the edge enough to read as a shadow. If a shadow looks wrong, raise the blur before changing anything else.
The third mistake is the same shadow on everything. A card, a button, and a modal should not share one shadow, because they sit at different heights. Cards get a small shadow, buttons get a smaller one, and modals get a big soft one. One shadow for the whole page flattens the design instead of giving it depth.
The fourth mistake is an offset that fights the light. If the page has a light source at the top left, every shadow should fall down and right. A shadow that falls up and left on one element and down and right on another looks broken, because the light cannot be in two places at once. Keep the offsets consistent across the page.
How to use this box shadow generator
Set the horizontal offset from minus 50 to 50, the vertical offset from minus 50 to 50, the blur from 0 to 100, and the spread from minus 50 to 50. Type the shadow colour as a hex code. The CSS string and the live preview update instantly as you type. There is no button to press.
Copy the CSS string for your stylesheet. It reads box-shadow: 4px 4px 12px 0px #000000 with your own values. Paste it as the box-shadow of any element, and the shadow appears. For a softer shadow, replace the hex colour with an rgba colour at low opacity, like rgba(0, 0, 0, 0.15).
Tune by eye. Start from the default, raise the blur until the edge looks soft, then adjust the offsets until the shadow sits where the light would put it. The preview box shows the shadow on a white page; check it on your real background too, because a shadow looks different on a dark page. A background color changer shows what the shadow looks like against a different page colour.
Everything runs in your browser. No sign-up, no account, no data sent anywhere. The numbers you typed never leave your device, and the page works offline once it has loaded.