The CSS inset keyword on box-shadow reverses the shadow direction so it appears inside the element rather than outside it, creating the visual impression of a recessed or pressed surface rather than a floating elevated one.
Loading Shadow Effect Builder…
Visual builder for inset box-shadow declarations
Live preview of recessed and pressed surface effects
Supports combining inset and outer shadow in one rule
Free browser-based tool with no login required
Drop the Shadow Effect Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/shadow-effect-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Shadow Effect Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
By default, box-shadow renders outside the element's border edge, making the element appear to float above its background surface. Adding the inset keyword fundamentally reverses this behaviour: the shadow is rendered inside the border edge, making the element appear to be pressed into or carved out of its background surface rather than floating above it. The offset values still control direction, but the interpretation inverts. A positive horizontal offset moves the shadow toward the right inner edge of the element, and a positive vertical offset moves it toward the top inner edge, opposite to the outer shadow behaviour. Blur softens the inner shadow edge in the same way as for outer shadows, and spread expands the inset shadow inward toward the centre of the element.
The most common use cases for inset shadows span several distinct UI component types and represent some of the most polished interaction patterns in modern interface design. Text inputs are often given a subtle inset shadow to make them look sunken and interactive: box-shadow: inset 0 1px 3px rgba(0,0,0,0.15) on a white input sitting on a light grey form background clearly signals to the user that the field is clickable and will accept input, without needing a heavy border or background colour shift. Toggle switches use a stronger inset shadow in the off state to communicate that the switch is inactive and pushed in, with the shadow removed or replaced by a coloured glow in the on state. Pressed button states use a small inset shadow combined with a slightly reduced outer shadow to simulate the physical action of pressing a real button downward into its housing.
Combining inset and standard outer shadows in a single box-shadow declaration gives precise control over both inner and outer depth simultaneously. The CSS property accepts a comma-separated list where each item can independently be inset or not, with no limit on the mix. For example, box-shadow: 0 2px 6px rgba(0,0,0,0.15), inset 0 1px 3px rgba(0,0,0,0.1) applies an outer elevation shadow and an inner highlight shadow in the same declaration. This composition technique creates the appearance of an element both floating above its parent surface and having internal depth within itself, which is particularly useful for premium card components with interactive surfaces, glossy buttons with inset highlight reflections, and panels that need both elevation and tactile inner detail.
Inset shadows require careful calibration against the element's background colour to read correctly. A dark inset shadow on a dark element produces almost no visible effect because the contrast between shadow and background is too low. A heavy inset shadow on a small element can overwhelm the visible interior and make the element look damaged rather than recessed. The reliable approach is to keep inset shadow offsets proportional to element size, use opacity in the 0.10 to 0.20 range for general inset work, and always preview the inset effect against the actual element fill colour rather than a generic white test surface. When inset shadows are calibrated correctly they add tactile polish; when miscalibrated they look broken.
Enable the inset toggle in the builder, then set a small offset and moderate blur to create a sunken effect. For pressed button states, use a small inset with a dark shadow at the top and a lighter shadow at the bottom to simulate physical depression.
Step-by-step guide to css inset shadow generator:
Enable inset mode in the builder
Toggle the Inset option in the builder controls to switch the preview from an outer shadow rendering to an inset shadow rendering. The preview will immediately update to show how the same offset, blur, and colour values appear when applied inside the element rather than outside it. The inset toggle is the foundational choice that determines whether you are building an elevation effect or a recession effect.
Set offset and blur for the recessed effect
Use a small vertical offset between 1 and 3 pixels for the subtle sunken input field look, or a larger offset between 4 and 8 pixels for a more deeply pressed surface appearance suitable for pressed button states and heavy panel recession. Adjust blur radius to control the softness of the inner shadow edge, with lower blur producing crisp edges and higher blur producing diffused interior shading.
Choose shadow colour and opacity
Select a dark colour at low opacity, typically rgba(0,0,0,0.10) to rgba(0,0,0,0.20), for the most natural recessed look that reads as ambient interior shadow. For more stylised effects, choose a saturated brand colour for a coloured inner glow that suggests the recessed surface is lit by coloured light from below, useful in gaming UI and themed dashboards where standard neutral inset shadows feel too plain.
Copy and apply the CSS
Copy the generated inset box-shadow declaration to your clipboard and add it to the relevant CSS rule for your button :active state, your text input, your toggle switch, or your panel component. The output is standard browser-ready CSS that works in every modern browser without prefixes. Pair the inset shadow with appropriate transition timing for smooth animation between states if the inset effect appears on a hover or active interaction.
Common situations where this approach makes a real difference:
Sunken text input fields on a form
A form designer adds box-shadow: inset 0 1px 3px rgba(0,0,0,0.12) to all text input fields on a contact form sitting against a light grey form background. The subtle inset shadow makes each input appear gently recessed into the form surface, clearly distinguishing editable fields from static labels and section headings without needing a visible border around each input. The result reads as a more sophisticated form design than the default browser input rendering and matches the visual language of premium form libraries used in production SaaS dashboards.
Toggle switch off state
A UI developer is building a settings panel toggle switch component. In the off state, the switch background uses box-shadow: inset 0 2px 6px rgba(0,0,0,0.25) to make it look distinctly pressed in and visually inactive, with the inset shadow communicating that the control is currently deselected. In the on state, the inset shadow is replaced with a subtle outer glow in the brand colour, clearly communicating the state transition to the user without requiring an animated label or additional visual indicators alongside the switch itself.
Pressed button in a calculator UI
A developer is building a browser-based scientific calculator interface where each numeric and operator key needs to feel tactile and responsive to user input. Each button has an outer shadow at rest to suggest physical elevation. On :active during a click or tap, the outer shadow is replaced with box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), giving the button an immediately pressed-in appearance. The fast 0.08 second transition makes each key feel tactile and confirms to the user that their input registered, even before any number appears on the calculator display.
Embossed panel in a skeuomorphic music app
A designer is building a skeuomorphic equalizer UI for a music production application and adds a recessed panel effect to the frequency band display area where the visualisation animates. Two inset shadows in opposite directions, one dark at the top edge and one lighter at the bottom edge, create a believable bevelled inset effect that makes the panel look carved into the brushed metal background texture of the surrounding interface. The technique reinforces the physical control surface metaphor that defines the application's design language.
Use this when building pressed button states, sunken text input fields, toggle switches in the off position, or any UI element that should appear recessed into the page surface.
Get better results with these expert suggestions:
Match inset shadow depth to element size
A large panel measured at several hundred pixels per side can comfortably handle a 6 to 10 pixel inset shadow offset without looking distorted or cartoonish. A small button at 36 pixels height should use a 1 to 2 pixel inset offset maximum, because anything larger overwhelms the limited interior surface. Scaling shadow values proportionally to element size keeps the recessed visual effect perceptually consistent across components of different sizes within the same interface, so a button and a panel both read as having the same approximate depth despite using different absolute pixel values.
Use negative spread to concentrate inset shadows at edges
A negative spread value on an inset shadow pulls the shadow away from the opposing edges, concentrating its visible weight near the offset direction. This creates a more precise recessed highlight at one specific edge rather than a uniform inner glow surrounding the entire element interior, which more closely matches the appearance of real single-direction lighting falling into a recessed surface. The technique works particularly well on toggle switches and sunken input fields where you want to imply a specific lighting angle rather than ambient interior darkness.
Animate between inset states for toggle interactions
Toggle switch components transition between off and on states with clear visual feedback. Animating the box-shadow property from an inset shadow representing the off state to a coloured outer shadow or glow representing the on state with a 0.2 second transition provides immediate visual state feedback without requiring JavaScript class management for the visual portion of the change. The animation reinforces the physical metaphor of the toggle being flipped, making the interaction feel tactile and responsive rather than purely abstract or data-driven.
Avoid inset shadows on elements with background images
Inset shadows applied to elements with a background-image can be very difficult to read if the image is visually busy, because the shadow competes with image detail and may disappear into noise. If you need a recessed effect on an image container, apply the inset shadow to a pseudo-element such as ::after positioned absolutely over the image rather than directly on the container itself. This gives you full control over the shadow's visibility, opacity, and blend mode without the underlying image content interfering with the shadow rendering or competing for the viewer's attention.
Use inset shadows to make inputs look interactive
A subtle inset shadow on text inputs distinguishes them from static text and tells users the field is editable. box-shadow: inset 0 1px 3px rgba(0,0,0,0.12) is enough to create the recessed effect without looking heavy.
Combine with :active for real button press feedback
Apply no inset shadow at resting state, a small outer shadow at :hover, and an inset shadow at :active. The transition from outer to inset shadow on click gives tactile feedback that the button was pressed.
Use two inset shadows for a bevel effect
One inset shadow at the top in a lighter colour and one at the bottom in a darker colour creates a bevelled or embossed inner edge. This is the technique used for sunken panel backgrounds in skeuomorphic UI.
More use-case guides for the same tool:
Open the full Shadow Effect Builder — free, no account needed, works on any device.
Open Shadow Effect Builder →Free · No account needed · Works on any device