CSS Box Shadow Generator
Build a CSS box-shadow with up to 5 layers: offset, blur, spread, color, opacity and inset. Copy CSS, Tailwind, SCSS, CSS-in-JS or a variable. How it works
Use the CSS Box Shadow Generator
Shadow Layers (1/5)
Keyboard Shortcuts
box-shadow: 10px 10px 20px 0px rgba(0, 0, 0, 0.25);
About the CSS Box Shadow Generator
A CSS box-shadow is written offset-x offset-y blur spread color, for example box-shadow: 10px 10px 20px 0px rgba(0, 0, 0, 0.25);, which is the shadow the generator starts with. Stack up to five comma-separated layers, make any of them inset, and copy the result as CSS, a Tailwind shadow-[...] class, SCSS, CSS-in-JS or a CSS variable. The shadow can go on the element itself or on its ::before or ::after pseudo-element, and the code then adds the content: "" a pseudo-element needs before it is drawn, position: absolute, inset: 0 and border-radius: inherit to lay it over the box, and position: relative on the element.
How to use this tool
- Move the sliders or type values for horizontal offset, vertical offset, blur, spread, color and opacity. The arrow keys change a number by 1 px, or 10 px with Shift.
- Click Add Layer for a second shadow, or tick Inset to draw a layer inside the box. The first layer is drawn on top.
- Under Apply the shadow to, keep element or pick ::before or ::after. A pseudo-element target writes .element { position: relative; } and .element::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: ...; } in CSS, and relative after:content-[''] after:absolute after:inset-0 after:rounded-[inherit] after:shadow-[...] in Tailwind.
- Pick CSS, Tailwind, SCSS, CSS-in-JS or Variable and copy the code.
Frequently asked questions
- What order are the values in a CSS box-shadow?
- Horizontal offset, vertical offset, blur radius, spread radius, then color, with an optional inset keyword. Only the two offsets are required. A negative horizontal offset moves the shadow left and a negative vertical offset moves it up.
- What is the difference between blur and spread?
- Blur softens the shadow’s edge: 0 is a sharp edge and larger values spread it out. Spread makes the shadow bigger when positive and smaller when negative, before the blur is applied.
- Can a box-shadow have a negative blur?
- No, CSS does not allow it. The generator keeps blur between 0 and 100 px, offsets between -100 and 100 px, spread between -50 and 50 px and opacity between 0 and 1, whether you type, click or use the arrow keys.
- How do I add more than one box-shadow?
- Separate the shadows with commas in one box-shadow value. The first one listed is on top. The generator supports up to five layers and writes them in that order.
- How do I use this shadow in Tailwind CSS?
- Pick Tailwind in the output tabs and copy the shadow-[...] class, which uses underscores in place of spaces. The Tailwind MD and Tailwind LG presets load the values of the shadow-md and shadow-lg utilities: 0 4px 6px -1px and 0 2px 4px -2px for md, 0 10px 15px -3px and 0 4px 6px -4px for lg, at 10% black.
- Does a box-shadow change the size of the element?
- No. A box-shadow is painted outside the box without changing its size or pushing other content aside, so a large shadow can overlap neighbors unless you add margin.
Related Tools
View all toolsCSS Text Shadow Generator
Stack up to 5 text-shadow layers with offset, blur, color and opacity, preview them on light or dark, and copy the CSS, variable or Tailwind class.
CSS Gradient Generator
Build linear, radial and conic gradients from color stops, ten presets or the colors of an image you upload, then copy CSS, Tailwind, React or SCSS code.
CSS Border Radius Generator
Set a CSS border-radius for each corner in px or %, with elliptical radii and a live preview. Copy CSS, Tailwind, React Native, SCSS or clip-path code.
CSS Transform Generator
Set translate, rotate, scale, skew, 3D rotation and perspective and see the CSS transform on a live box. Copy CSS, Tailwind, SCSS or custom properties.
CSS Filter Generator
Combine blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia and drop-shadow on a preview; copy CSS, Tailwind or an SVG filter.
CSS Flexbox Generator
Set flex-direction, wrap, justify-content, align-items, gap and per-item flex, order and align-self, then copy the code as CSS, SCSS, variables or Tailwind.