A box shadow generator example is a complete, copy-ready CSS declaration of the form box-shadow: H-offset V-offset blur spread rgba(R, G, B, A);, optionally prefixed by the keyword inset to move the effect inside the border edge. The declaration follows the component model defined in the CSS Backgrounds and Borders Level 3 specification, where each numeric length is a CSS pixel value and the color is an rgba color with an alpha channel between 0 and 1. The CSS Box Shadow Generator produces exactly one bounded shadow layer at a time, with no comma-separated stacks, no Tailwind tokens, and no vendor prefixes, so the output is a single string that can be pasted into a real style rule. This walkthrough uses a soft elevated card shadow as the worked example, explains the reasoning behind each control value, and finishes by placing the result in a live selector so the appearance can be confirmed against themes, focus states, and actual device rendering.

Anatomy of a Generated Box Shadow Declaration
The generator serializes its output in a deterministic order: an optional inset keyword first, then the horizontal offset, the vertical offset, the blur radius, the spread radius, and finally an rgba color. That ordering matches the CSS Backgrounds and Borders Level 3 box-shadow component model, so the declaration is parsed the same way by every modern browser engine, although the rendered shadow can still vary with pixel density, transforms, zoom, compositing, and the shape of the element. A typical single-layer output looks like this:
box-shadow: 4px 8px 16px 0px rgba(0, 0, 0, 0.25);
Each piece carries its own meaning. The horizontal and vertical offsets position the shadow relative to the element's box. The blur radius softens the edge, with zero producing a hard outline and larger values expanding the transition zone. The spread radius enlarges or contracts the shadow shape before blur is applied, so a positive spread produces a chunkier shadow and a negative spread produces a thinner one. The rgba color holds the visible tint and the alpha, where an alpha of 0 produces an invisible shadow that is still syntactically present in the rule. Nothing about this string is platform-specific, which is why the generator does not add legacy -webkit- or -moz- prefixes or attempt to detect a target browser.
Inputs, Ranges, and What Each Control Does
Every control in the generator maps directly to one position in the output string, and each control has a fixed operating range. The bounds below describe the maximum reach of each slider; values inside the range produce identical declarations, while values at the extremes stay legal CSS but may look poor in practice.
| Control | Range | Effect on the output |
|---|---|---|
| Horizontal offset | -200 to 200 px | Positive shifts the outer shadow right, negative shifts it left; the same offset affects the perceived inner shadow direction when inset is on. |
| Vertical offset | -200 to 200 px | Positive shifts the outer shadow downward, negative shifts it upward; the same offset affects the perceived inner shadow direction when inset is on. |
| Blur radius | 0 to 200 px | Larger values soften and expand the edge; zero gives a hard outline. |
| Spread radius | -100 to 100 px | Positive enlarges the shadow shape before blur; negative contracts it. |
| Color | Six-digit hexadecimal | Red, green, and blue channels are converted to decimal rgba components. |
| Opacity | 0 to 100% | Serialized as alpha 0 through 1, rounded to three decimal places. |
| Inset | Toggle | Adds the inset keyword first to draw the shadow inside the border edge. |
These ranges explain why a heavily negative spread can leave an outer shadow effectively invisible: the shadow shrinks below a usable shape before blur is applied. The same limits clarify why blur and spread are deliberately separate controls, since spread shapes the footprint while blur softens the edge. For a quick lookup of additional parameter combinations worth trying, the Box Shadow Generator Cheat Sheet collects several compact recipes.
Build a Soft Elevated Card Shadow (Worked Example)
The example below produces a calm, soft shadow suitable for a card or panel resting on a light surface. The reasoning behind each value is given so the recipe can be retuned rather than copied blindly. The CSS Box Shadow Generator reproduces the exact declaration shown at the end of the steps.
- Set the horizontal offset to 4 px. A small positive value nudges the shadow right, mimicking a light source from the upper left.
- Set the vertical offset to 8 px. A larger positive value than the horizontal offset produces a believable downward drop without making the card feel detached.
- Set the blur radius to 16 px. Keeping blur larger than the offset softens the edge so the shadow reads as ambient light rather than a hard outline.
- Leave the spread radius at 0 px. Zero spread keeps the shadow the same size as the element, which avoids a chunky halo on small components.
- Pick a six-digit hex color for the shadow tint, such as #1F2937, and leave the inset toggle off. That hex value has red channel 1F (decimal 31), green 29 (decimal 41), and blue 37 (decimal 55), as the conversion below shows.
- Set opacity to 25%. The generator divides by 100 and rounds to three decimal places, so 25% becomes alpha 0.250.
- Read the declaration under the preview. The generator will serialize the values as box-shadow: 4px 8px 16px 0px rgba(31, 41, 55, 0.250);.
- Copy that string and paste it into the rule for the card, then preview on the real component.
The arithmetic for the color conversion is the only calculation worth memorizing: 1F in base 16 equals 1 x 16 + 15 = 31, 29 equals 2 x 16 + 9 = 41, and 37 equals 3 x 16 + 7 = 55. With opacity at 25%, alpha becomes 25 divided by 100 = 0.25, which the tool rounds to 0.250. That is the entire transformation from slider positions to a final declaration, and the resulting string is what the generator exposes for the clipboard.
Adapt the Same Recipe for Inset Panels and Pressed Controls
Enabling inset moves the shadow from outside the element's border edge to inside it. The same offsets and the same alpha still apply, but the visual meaning flips: a positive vertical offset, which made the card look elevated before, now makes the inner edge appear lit from above, while a negative offset makes it appear lit from below. The generator serializes the inset keyword first, so the recipe above becomes box-shadow: inset 4px 8px 16px 0px rgba(31, 41, 55, 0.250); with the toggle flipped. That single change covers recessed panels, pressed buttons, and inner highlights without rewriting any other value.
Two controls often confuse readers, so the table below keeps them straight.
| Question | Blur | Spread |
|---|---|---|
| What does it change? | Softness of the edge transition. | Size of the shadow shape before the edge is blurred. |
| Negative allowed? | No, clamped to 0. | Yes, between -100 and 100 px. |
| Effect at zero? | Hard outline. | Shadow is exactly the element's footprint. |
| Effect when large? | Wider, softer falloff without moving the center. | Bigger shadow footprint that can dwarf the element. |
Because both controls are independent, a calm inset panel usually pairs a small spread with a blur roughly twice the offset, while a sharp pressed effect pairs zero blur with a small negative spread.
Place the Declaration in a Real Selector
The string the generator emits is a complete CSS declaration. It is not wrapped in a style tag, a selector, an HTML fragment, or any JavaScript, so the next step is yours. Paste the output into the rule that targets the card, panel, or button, and then verify the appearance in the contexts where the component will actually live. A declaration that looks ideal on a white sample card can look muddled on a textured background or disappear entirely on a high-contrast theme.
A few checks are worth running before shipping the example:
- Test the rule under both a light surface and a dark surface. A pure black shadow at low alpha can vanish against a near-black background, while a high-alpha shadow on a bright surface can feel heavy.
- Toggle focus, hover, disabled, and active states. A shadow that reads cleanly when idle can fight a focus ring or a hover outline, so the offsets or alpha may need a second pass for those states.
- Open the component on a real device rather than only a desktop browser. Pixel density, browser zoom, and compositing layers all subtly shift the visible footprint.
- Check reduced-transparency and high-contrast preferences where the platform exposes them. A shadow that carries meaning on its own can become misleading when the operating system reduces opacity for accessibility.
- Keep shadows as reinforcement, not as the only signal. The W3C box-shadow component treats shadows as decoration, and the component should remain readable without them.
The generator does not save settings, so once a working recipe is verified, paste the declaration into the project stylesheet directly. The string is plain text, the order is deterministic, and the output follows the CSS Backgrounds and Borders box-shadow component model in a deterministic order.
Related reading: How to Make CSS Buttons With a Visual Generator.