Developer Tools

CSS Gradient Calculator

Generate CSS gradient code for linear and radial gradients. Create beautiful color gradients with angle and color stops.

Use CSS Gradient Calculator to get instant results without uploads or sign-ups. Everything runs securely in your browser for fast, reliable output.

Your results will appear here.

Ready to run.

About this tool

CSS gradients create smooth color transitions without images. Our CSS Gradient Calculator generates ready-to-use gradient code for modern web design.

Linear gradients flow in one direction, radial gradients emanate from a center point. Add multiple color stops for complex gradients. Copy-paste generated CSS into your stylesheets.

Usage examples

Horizontal Gradient

Left to right gradient

linear-gradient(90deg, #667eea 0%, #764ba2 100%)

Diagonal Gradient

Top-left to bottom-right

linear-gradient(135deg, #f093fb 0%, #f5576c 100%)

How to use

  1. Select "Gradient Type" (linear or radial).
  2. Enter "Start Color" and "End Color" in HEX.
  3. For linear: Set "Angle" (0-360 degrees).
  4. Click "Generate" to get CSS code.

Benefits

  • CSS-ready gradient code
  • Linear and radial gradients
  • Custom angles
  • Multiple color stops
  • Copy-paste ready
  • Modern web design

FAQs

What is a CSS gradient?

CSS gradient is a smooth transition between colors using background-image property. Types: linear-gradient (straight direction), radial-gradient (circular), conic-gradient (sweeping around point). Advantages: scalable, no HTTP request, customizable, supports transparency.

How do I create a linear gradient in CSS?

Syntax: background: linear-gradient(direction, color1, color2, ...); Direction: angle (90deg = left to right) or keywords (to right, to bottom). Example: background: linear-gradient(90deg, red, blue); Color stops: red 0%, blue 100%.

What is the difference between linear and radial gradients?

Linear gradients: transition along a straight line (horizontal, vertical, diagonal). Radial gradients: transition from center point outward in circular or elliptical shape. Use linear for backgrounds, buttons. Use radial for spotlights, vignettes, circular elements.

Can I use more than two colors in a gradient?

Yes! Add multiple color stops: linear-gradient(90deg, red 0%, yellow 50%, blue 100%). Each stop has color and position (%). Use 3-4 colors for sunsets, rainbows, or complex backgrounds. Too many colors can look muddy.

How do I make a gradient background?

Apply to background-image (not background-color): body { background-image: linear-gradient(180deg, #fff, #000); }. For fixed gradient on scroll, add: background-attachment: fixed; Can layer multiple gradients using commas.

What are popular gradient color combinations?

Trending gradients: Purple-pink (#667eea to #764ba2), Orange-red (#fa709a to #fee140), Blue-purple (#4facfe to #00f2fe), Green-blue (#43e97b to #38f9d7), Sunset (#ff6b6b to #feca57). Check UI Gradients, Gradient Hunt, WebGradients for inspiration.

Can I animate CSS gradients?

CSS gradients can't be directly animated with transitions. Workaround: animate opacity between two overlaid gradients, use pseudo-elements, or animate background-position on a larger gradient. For smooth animations, consider CSS variables with @property or use SVG gradients. JavaScript libraries like GSAP can also animate gradient colors.

Do CSS gradients affect page performance?

CSS gradients are efficient as they're rendered by the browser, not downloaded as images. However, complex gradients (many color stops, large areas) can impact paint performance on older devices. Best practices: limit gradient complexity, use solid colors for small elements, avoid animating gradients, consider caching gradients in CSS custom properties.

Related tools

View all tools