CSS Shadow Generator
Move the sliders to set the offset, blur, spread, colour and opacity of a shadow and watch the preview change. Choose box shadow, text shadow or the drop shadow filter, stack up to six layers, and switch a box shadow to inset. When it looks right, copy the CSS. Everything runs in your browser.
Shadow 1
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.25);
Related Tools
[5 suggestions]CSS Gradient Generator
Design linear, radial and conic CSS gradients with any number of colour stops, preview them live and copy the CSS.
Developer & WebColor Converter and Contrast Checker
Convert a color between HEX, RGB and HSL, look up CSS color names, and check the WCAG contrast ratio of text on a background.
Developer & WebPX to REM Converter
Convert px to rem, em, pt, pc, vw and percent for CSS, with your own root font size, parent size and viewport width.
Developer & WebAspect Ratio Calculator
Find the aspect ratio of any width and height, resize while keeping it, and get the CSS aspect-ratio rule.
Developer & WebHTML to Image Converter
Turn HTML and CSS into a PNG, JPEG, WebP or SVG image in your browser, with a live preview, any size, a 1x to 4x scale and a transparent background.
Developer & WebAbout the CSS Shadow Generator
The CSS shadow generator writes the value of box-shadow, text-shadow or filter: drop-shadow() for you. A shadow has a horizontal and a vertical offset, a blur radius, and for box shadows a spread, which grows or shrinks the shadow before it is blurred, and an optional inset keyword that draws the shadow inside the box. The blur is not a size in pixels of a soft edge: according to the CSS specification, the shadow is blurred as if by a Gaussian blur whose standard deviation is half of the blur radius, so a 12px blur has a standard deviation of 6px. A drop shadow counts differently: its blur value is the standard deviation itself, so a drop shadow with a blur of 6px looks the same as a box shadow with a blur of 12px, which we confirmed in Chromium. Text shadows and drop shadows have no spread and no inset, so the tool hides those controls and leaves them out. A drop shadow follows the shape of what is drawn, including transparent corners of an image, where a box shadow always follows the rectangle. Colour is entered as a hex value with a separate opacity, and written as rgba() when the opacity is below 100. Several layers are written as a comma separated list, with the first one on top. The generated values were tested in Chromium: for 400 random shadows of every kind, the computed style held exactly the numbers, colours and inset flags that were set. For 194 box shadows with whole pixel offsets, more than 300,000 pixels were compared with a Gaussian model of the blur, and the average difference was 0.02 levels of colour out of 255. Everything runs in your browser and nothing is uploaded.
How do I make a CSS box shadow?▾
Write box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.25); on the element. The four lengths are the horizontal offset, the vertical offset, the blur and the spread, followed by the colour. This tool builds the line and shows a preview.
What is the difference between blur and spread?▾
Blur softens the edge of the shadow, and a larger value makes it fade over a wider area. Spread makes the shadow bigger or smaller before it is blurred: a positive spread grows it on every side, and a negative spread shrinks it, which is how soft shadows that sit tightly under a box are made.
What is the difference between box-shadow and drop-shadow?▾
A box shadow always follows the rectangle of the element and its rounded corners. A drop shadow, made with filter: drop-shadow(), follows the shape of what is actually drawn, so a PNG with transparent areas or an irregular shape gets a shadow of that shape. Drop shadows have no spread or inset.
How do I add several shadows?▾
Add a shadow layer for each one. CSS takes a comma separated list, and the first shadow is drawn on top. Stacking a small sharp shadow with a large soft one is a common way to get a more natural look.
Is my data uploaded?▾
No. The shadow is built in your browser, and nothing you choose is sent anywhere or stored.