Free Animated CSS Gradient Generator

Create eye-catching animated gradient backgrounds using pure CSS. Choose animation type, adjust speed and direction, then copy the complete CSS including @keyframes.

The Background-Size Animation Technique

CSS gradient animations use a clever technique: create a gradient larger than the element using background-size: 200% 200%, then animate the background-position with @keyframes. The oversized gradient scrolls behind the element, creating a smooth flowing effect at 60fps.

Three Animation Modes

The Shift animation slides the gradient across the element — best for hero sections and backgrounds. Hue Rotate cycles the gradient through all colors using filter: hue-rotate() — ideal for loading states. Pulse fades the gradient opacity — subtle enough for buttons and cards.

Performance Considerations

Modern browsers GPU-accelerate CSS animations, so performance is generally excellent. Use will-change: background-position as a hint. Longer durations (6-10s) feel more elegant. Consider the prefers-reduced-motion media query to respect user preferences.

Create your animated gradient below.

deg
Color Stops
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background-size: 200% 200%;
animation: gradient-shift 6s ease infinite;

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

What Is the Animated Gradient Generator?

This free tool creates animated CSS gradient backgrounds without JavaScript. Choose from three animation types — shift, hue-rotate, and pulse — adjust the speed from 2 to 15 seconds, and copy the complete CSS including the @keyframes rule. The animation is enabled by default, so you see the flowing gradient immediately. The generated code is production-ready and works in all modern browsers.

How to Use This Tool

Step 1: See the animation. The tool loads with animation already enabled. You'll see a flowing gradient in the preview immediately.

Step 2: Choose your colors. Edit the color stops or select a preset from the gallery. The animation applies to whatever gradient you build.

Step 3: Adjust the animation. Select the animation type (shift, hue-rotate, or pulse), set the speed with the slider, and choose a direction (forward, reverse, or alternate).

Step 4: Copy the complete CSS. The code output includes the gradient, @keyframes rule, background-size, and animation properties. Copy everything and paste into your stylesheet.

Key Features

Three animation types. Shift creates a flowing movement using background-position keyframes. Hue-rotate cycles through the entire color spectrum using CSS filters. Pulse fades the gradient opacity between 70% and 100% for a breathing effect.

Adjustable speed and direction. Control the animation duration from 2 seconds (energetic) to 15 seconds (calm, ambient). Choose forward, reverse, or alternate playback. The preview animates in real-time so you can fine-tune the feel.

Complete code output. The generated CSS includes everything needed: the gradient declaration, background-size, the @keyframes rule, and the animation shorthand property. One copy-paste is all it takes.

Works with all gradient types. Animate linear, radial, conic, or mesh gradients. The shift animation works with any type. Hue-rotate and pulse work universally since they use CSS filters and opacity.

How CSS Gradient Animations Work

The shift technique. Set background-size: 200% 200% to make the gradient twice as large as the element. Then animate background-position from 0% 50% to 100% 50% and back. The oversized gradient slides behind the element, creating continuous flowing motion. Duplicate the first color at the end of the stops list for seamless looping.

The hue-rotate technique. Apply the gradient normally, then animate filter: hue-rotate() from 0deg to 360deg. This shifts every color in the gradient through the entire spectrum. The effect is dramatic and works especially well with rainbow or analogous color schemes.

The pulse technique. Animate opacity between 0.7 and 1.0 using an ease-in-out timing function. This creates a subtle breathing effect that adds life to otherwise static gradient backgrounds. It's the least distracting animation type and works well even behind content.

Respecting user preferences. Wrap your animation in a @media (prefers-reduced-motion: no-preference) query to automatically disable it for users who prefer reduced motion. This is an accessibility best practice that ensures your animated gradient doesn't cause discomfort.

Frequently Asked Questions

How do CSS gradient animations work?

The most common technique uses background-size: 200% 200% to create an oversized gradient, then a @keyframes animation shifts the background-position. This creates a smooth, continuous flowing effect using pure CSS — no JavaScript needed.

What animation types are available?

Three types: Shift (background-position animation for a flowing effect), Hue Rotate (CSS filter that cycles through colors), and Pulse (opacity animation between 70% and 100%). Each type creates a distinct visual effect.

Will animated gradients affect performance?

CSS gradient animations are GPU-accelerated in modern browsers. The shift and pulse techniques use transform-friendly properties. Hue-rotate uses CSS filters which are also hardware-accelerated. For most use cases, the performance impact is negligible.

Can I control the animation speed?

Yes. Use the speed slider to set duration from 2 seconds (fast) to 15 seconds (slow). You can also choose forward, reverse, or alternate direction. The preview shows the animation in real-time as you adjust.

Where should I use animated gradients?

Hero sections, loading screens, button hover states, and decorative backgrounds are ideal use cases. Use them sparingly — one animated gradient per page is usually enough. Avoid animating gradients behind text-heavy content, as the motion can be distracting.

Does the generated code include @keyframes?

Yes. The CSS output includes the complete @keyframes rule, animation property, and background-size declaration. Copy and paste the entire block into your stylesheet — nothing else is needed.

Related Tools