Free developer tool

CSS Gradient Generator

Choose two colors, a gradient type and an angle. The tool shows a live preview and gives you the CSS background code to paste into your stylesheet.

Report a problem or suggest a fix for this tool

What is css gradient generator?

A CSS gradient is a smooth blend between colors drawn by the browser, with no image file needed. Gradients make backgrounds, buttons and hero sections look modern and load instantly.

This generator creates linear, radial and conic gradients with a live preview and ready to use code.

How to use the css gradient generator

  1. Pick the type and two colors.
  2. Set the angle for linear and conic gradients.
  3. Copy the CSS.

How the css gradient generator works

A linear gradient uses the angle as the direction of the blend. A radial gradient spreads from the center outwards. A conic gradient sweeps around a point like a color wheel. The code is built from your colors and angle.

Worked example

A linear gradient at 90 degrees from indigo to teal reads linear-gradient(90deg, #4f46e5, #14b8a6).

Common uses of the css gradient generator

  • Hero section backgrounds.
  • Button and card styles.
  • Brand headers.
  • Replacing background images.
  • Designing quickly without a graphics tool.

Tips and common mistakes

Keep text contrast high on gradient backgrounds.

Choose colors that are close in hue for a smooth look.

Background: what to know before you rely on it

Gradients were once made as image files, which cost bandwidth and looked soft on high density screens. CSS gradients are resolution independent, so they stay sharp at any size and weigh a few dozen bytes. Designers use them for depth and emphasis, but too many colors or harsh transitions look dated. A two color gradient in related hues is a safe choice. Always check text contrast in the lightest and darkest parts of the gradient, not just in the middle.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Field by field guide

  • Type: Choose one of: Linear; Radial; Conic.
  • First color: Pick a color.
  • Second color: Pick a color.
  • Angle (degrees): Enter a number. The example value is 90.

Change one field at a time to see how the result responds, and use the worked example above to check that you get the same answer.

Building gradients that work

A gradient needs at least two color stops and a direction. The tool gives CSS you can paste in.

Practical scenarios

  • Making a hero background with two brand colors.
  • Creating a subtle top to bottom fade on a card.
  • Matching a button to a theme.

Common mistakes

  • Putting text over strong contrast changes. Check readability.
  • Using many stops, which looks busy.
  • Forgetting a solid fallback color for old browsers.

Designing gradients that look modern

A linear gradient blends colors along a line, a radial gradient spreads from a point and a conic gradient sweeps around a center. The generator writes the CSS for you.

Expert tips

  • Use colors that are close in hue and brightness for a subtle effect, and large jumps for a bold poster look.
  • Add a third stop in the middle to avoid a muddy gray where complementary colors meet.
  • Check text contrast on the lightest and darkest parts of the gradient.
  • Use background-size and background-position to animate gradients cheaply.
  • Provide a plain background color first as a fallback.

Gradients can add depth to buttons and hero sections, but too many compete with content.

Frequently asked questions

Do gradients slow a page down?

No. They are drawn by the browser and are lighter than an image.

What angle is left to right?

90 degrees.

Do all browsers support them?

Yes, all modern browsers support linear, radial and conic gradients.

Can I use more than two colors?

Yes, add more stops by hand in the code.

Embed this tool on your website

Copy the code below and paste it into your page or blog post. The tool is free to embed, runs in the visitor's browser and needs no account. Please keep the credit link.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.