·5 min read·Blog

How to Generate a CSS Gradient for Free (Linear, Radial, and Conic)

CSS gradients look like magic in code but follow a consistent pattern. Here's the syntax for every type — and the free visual tool to generate them without writing any CSS manually.

Generate gradients visually

Use the free CSS gradient generator — pick your colors, adjust the direction and type, and copy the ready-to-use CSS. No account required.

Linear gradients

The most common type — transitions colors in a straight line:

/* Simple two-color */
background: linear-gradient(to right, #ff6600, #ffcc00);

/* With direction in degrees */
background: linear-gradient(135deg, #667eea, #764ba2);

/* Multi-color with stops */
background: linear-gradient(to bottom, #ff0000 0%, #ff6600 50%, #ffcc00 100%);

The direction can be: to right, to bottom, to top left, or an angle in degrees (135deg = diagonal from top-left to bottom-right).

Radial gradients

Radiates from a center point outward:

/* Circle from center */
background: radial-gradient(circle, #ff6600, #ffcc00);

/* Ellipse from custom position */
background: radial-gradient(ellipse at top left, #667eea, #764ba2);

/* With stops */
background: radial-gradient(circle at center, #ffffff 0%, #e0e0e0 50%, #999 100%);

Use circle for a perfectly circular gradient or ellipse(default) to follow the element's shape.

Conic gradients

Rotates colors around a center point — like a color wheel or pie chart:

/* Color wheel */
background: conic-gradient(red, yellow, green, blue, red);

/* Pie chart segment */
background: conic-gradient(#4CAF50 0deg 90deg, #2196F3 90deg 180deg, #FF5722 180deg 360deg);

Conic gradients are newer (supported in all modern browsers since 2021) and excellent for pie charts and color wheel effects.

Making gradients look natural

A common problem: harsh-looking gradient transitions. Three techniques that help:

  1. Add a middle color stop: instead of jumping directly from color A to B, add an intermediate mixed color at 50% to smooth the transition.
  2. Use HSL colors: gradients between HSL values often look more natural than RGB because HSL represents how humans perceive color.hsl(0, 100%, 50%)hsl(60, 100%, 50%) produces a clean warm gradient.
  3. Avoid complementary color pairs: opposite colors on the color wheel (red/green, blue/orange) produce muddy brown in the middle. Adjust the middle stop or add a warm/cool neutral to bridge the gap.

Gradient text

You can apply gradients to text using a clip:

h1 {
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

Works in all modern browsers. The -webkit- prefix is still needed for Safari compatibility.

Repeating gradients

For stripe patterns and repeating textures:

/* Diagonal stripes */
background: repeating-linear-gradient(
  45deg,
  #f0f0f0,
  #f0f0f0 10px,
  #e0e0e0 10px,
  #e0e0e0 20px
);

Summary

CSS gradients use linear-gradient(), radial-gradient(), and conic-gradient(). Each takes a direction/shape and a list of color stops. For complex gradients, use the free CSS gradient generator to design visually and copy the code rather than writing stops manually.

Browse by category

Not sure which tool you need? Start with a category.

Everything you can do — for free

No software to buy. No account to create. Just open a tool and get it done.

Work with images

Compress photos before sending them by email, resize pictures for social media, remove backgrounds, or pick the perfect color for a design project — all without installing any app.

Edit and format text

Count words and characters in an essay, compare two documents side by side, convert text to different formats, or generate placeholder text for a presentation.

Stay safe online

Create a strong unique password in one click, check how secure a password is, encode or decode data, and generate secure tokens — your data never leaves your device.

Calculate anything

BMI, loan repayments, unit conversions, date differences, and dozens of other everyday calculations — no spreadsheet or formula knowledge required.

The Free AI Tools is a free collection of 221+ online tools that work directly in your web browser — no download, no installation, no account required. Whether you need to compress an image for email, count words in an essay, generate a strong password, create a QR code for your business, or format JSON for development — you will find a simple, free tool here.

Every tool is privacy-first: your files, text, and data never leave your device. Tools cover image editing, text processing, developer utilities, security & encoding, SEO & web, design & CSS, and more.

☕ Support Us