Color ToolsΒ·7 min

How to Create a CSS Gradient (Linear, Radial, Conic)

Learn how to design and code beautiful CSS gradients. Includes a free visual gradient generator.

Why use CSS gradients?

CSS gradients let you create smooth color transitions without image files. They are perfect for backgrounds, buttons, cards, and hero sections. Because gradients are generated in the browser from code, they scale perfectly to any resolution, add zero download weight, and can be tweaked instantly. The two main types are linear gradients (straight color flow) and radial gradients (circular color flow), with conic gradients (swept around a center) added more recently.

A well-chosen gradient can elevate a flat design, set a mood, or guide the eye to a call to action. The key is starting from a strong color pair and choosing the right direction and stops.

Common use cases

  • Hero sections: Eye-catching backgrounds for landing pages
  • Buttons: Subtle gradients make CTAs feel more clickable
  • Cards and panels: Background depth without images
  • Loading states: Smooth shimmer effects for placeholders
  • Borders and text: Newer CSS lets you apply gradients to text strokes and borders

Method 1: Use UtilBoxx's free CSS gradient generator (Recommended)

Our CSS gradient generator lets you pick colors, set stops, choose direction, and copy production-ready CSS. Here is how to use it:

  1. Go to utilboxx.com/en/tools/color/gradient
  2. Pick two or more colors with the color pickers
  3. Adjust stops, angle, and shape (linear, radial, conic)
  4. Preview the result live in the canvas
  5. Click "Copy CSS" to grab the snippet

Why this method works:

  • Live preview with no page reload
  • Exports clean, vendor-prefixed CSS
  • Supports linear, radial, and conic gradients
  • Lets you save and share gradients via URL
  • Works on mobile with touch-friendly controls

Method 2: Write the CSS by hand

A linear gradient in CSS looks like this:

```css background: linear-gradient(135deg, #ff7e5f, #feb47b); ```

For a radial gradient:

```css background: radial-gradient(circle at center, #6a11cb, #2575fc); ```

For a conic gradient (great for pie-chart effects):

```css background: conic-gradient(from 180deg, red, yellow, lime, cyan, blue, magenta, red); ```

You can use any number of color stops and percentages to control blending.

Method 3: Use a pre-made gradient library

Sites like uiGradients, Grabient, and ColorHub offer curated collections of beautiful gradients. You can browse, copy the CSS, and paste it into your project. This is the fastest option when you do not need a custom design.

Frequently asked questions

What is the difference between linear, radial, and conic gradients?

Linear flows in a straight line; radial radiates from a center point; conic sweeps colors around a center, like a color wheel. Each creates a different visual effect.

Do CSS gradients affect performance?

No. Gradients are computed by the browser's compositor and are essentially free at runtime. They have smaller payload than background images and scale to any resolution.

Can I use gradients in borders and text?

Yes. With `border-image: linear-gradient(...)` for borders, and `background-clip: text; color: transparent;` for text fills, you can apply gradients almost anywhere.

How do I make a gradient accessible?

Ensure adequate contrast with the text on top. Use a contrast checker to verify, and consider providing a solid-color fallback for users who prefer reduced motion or high contrast.

Conclusion

CSS gradients are a powerful, lightweight design tool. For a fast, visual workflow, the UtilBoxx CSS gradient generator is the easiest way to design and copy production-ready code.