CSS Gradient & Box Shadow Generator
Guide: px vs rem vs em: Which CSS Unit Should You Use?
background: linear-gradient(90deg, #6366f1 0%, #ec4899 100%);Nothing you enter or choose here leaves your device. This tool runs in your browser.
Gradients
Pick linear, radial or conic, add between 2 and 6 color stops, and drag the controls while the preview updates. When it looks right, Copy CSS gives you a line like this one:
background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
The angle sets the direction. 0 degrees points up, 90 points right, 180 points down and 270 points left, so 135 runs from the top left to the bottom right.
| Type | Looks like | Used for |
|---|---|---|
| Linear | Colors blend along a line | Backgrounds, buttons, headers |
| Radial | Colors spread out from a point | Spotlights, glows, soft vignettes |
| Conic | Colors sweep around a point | Pie charts, color wheels, loading rings |
| Repeating | The pattern tiles | Stripes, checks, ruled lines |
Gradient tips
- Two colors with similar brightness look smooth. Colors far apart in brightness can show a muddy middle, which an extra stop can fix.
- Put two stops at the same position for a hard edge instead of a blend, as in stripes.
- Keep text readable on top. Check the contrast against the lightest and darkest part of the gradient with the color converter.
- Subtle gradients, a few shades apart, look more professional than rainbow ones.
Box shadows
A shadow has an offset across and down, a blur, a spread and a color with opacity. You can stack up to five layers, which is the trick behind natural-looking shadows. Real light makes a tight dark shadow near the object and a large faint one further away, so two layers beat one heavy one:
box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 8px 24px -4px rgba(0,0,0,.15);
What spread does
Spread makes the shadow bigger or smaller before it's blurred. A negative spread with a large blur gives a soft shadow that sits mostly under the element and doesn't stick out at the sides. That's the look of a card floating just above a page. An inset shadow goes inside the box, which suits pressed buttons and text fields.
| Effect | Offset | Blur | Spread | Opacity |
|---|---|---|---|---|
| Subtle card | 0 / 1px | 2 to 3px | 0 | 10% |
| Raised card | 0 / 8px | 24px | -4px | 15% |
| Popup or modal | 0 / 20px | 40px | -8px | 25% |
| Pressed button | 0 / 2px inset | 4px | 0 | 20% |
Support and performance
Gradients and shadows work in every modern browser, including phones. Large blurred shadows on many elements, or on things that move, can slow a page down on weak devices, so use them with a little restraint. A gradient is also a lightweight alternative to an image, since it's drawn from a few numbers and not downloaded.
Everything runs in your browser. When the CSS is done, shrink it with the CSS minifier, and size text and spacing with the px to rem converter.
Written by Akinrinmade Michael · Updated October 24, 2026
How to use
- 1Choose Gradient or Box shadow.
- 2Adjust the controls and watch the live preview.
- 3Add color stops or shadow layers if you want more depth.
- 4Click Copy CSS and paste it into your stylesheet.
Frequently asked questions
Which gradient types are supported?
Linear, radial and conic, each with an optional repeating version. You can use between 2 and 6 color stops.
Can I stack several shadows?
Yes. Add up to five layers. Layered, softer shadows often look more natural than one heavy shadow.
What does spread do in a box shadow?
Spread grows or shrinks the shadow before it is blurred. A negative spread with a large blur gives a soft shadow that stays under the element.
Do these work in all browsers?
Gradients and box-shadow are supported in every modern browser, including mobile.
Read the guide
Learn how this works and how to get the most from it.
Web & SEO
px vs rem vs em: Which CSS Unit Should You Use?
The difference between px, rem and em in CSS, how to convert between them, and when each one is the right choice.
3 min read
Related tools
Color Converter & Contrast Checker
Convert HEX, RGB and HSL and check WCAG contrast ratios.
CSS Minifier & Beautifier
Compress CSS to save bytes, or format it so it is easy to read.
PX to REM Converter
Convert px to rem, em, pt and percent for any base font size.
QR Code Generator
QR codes for links, Wi-Fi, contacts, email, phone and text. PNG or SVG.