Build looping CSS backgrounds with an animated gradient generator
This animated gradient generator lets you design smooth, infinitely looping CSS keyframe gradient backgrounds visually, then export production-ready code in a single click. Pick two or more colors, set the angle, dial in the duration and easing, and watch the animation move in real time — no manual keyframe math required.
Under the hood, the tool uses the standard background-position technique: it paints a larger-than-container linear-gradient and slides it across the element. Animating background-position avoids layout and repaint work, which is the secret to a silky 60fps result on modern browsers.
What you can control
- Colors and stops — add, remove, and reorder color stops to design the gradient palette.
- Angle — rotate the gradient from 0° to 360° to change motion direction.
- Duration — set how long one full loop takes, from snappy 3-second cycles to slow 30-second ambient backgrounds.
- Easing — choose
linear,ease,ease-in-out, or a customcubic-bezier()curve. - Background size — control how far the gradient travels per loop (200%, 300%, 400%).
How the generated code works
Every export pairs a background: linear-gradient(...) declaration with an oversized background-size and an animation rule tied to a named @keyframes block. A typical result looks like:
.hero {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
}
@keyframes gradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
The full @keyframes at-rule syntax is documented on MDN, and the animation shorthand follows the W3C CSS Animations Level 1 specification.
Pair it with other color tools
Need a starting palette? Generate one with the gradient generator for static gradients, then bring the colors here to animate them. For trendier multi-blob looks, the mesh gradient generator produces blurry, modern UI backdrops. If your animated background sits behind text, run the foreground/background combos through the contrast checker to keep things accessible, and use the color harmony generator to pick stops that flow naturally.
Performance and accessibility tips
- Keep durations long (10s+) — fast loops feel jittery and can trigger motion sensitivity.
- Respect
prefers-reduced-motionby wrapping the animation in a media query. - Limit to 3–5 color stops; more stops increase paint cost without much visual gain.
- Test on mobile — animated backgrounds can drain battery on lower-end devices.
With those guardrails in place, an animated gradient generator is one of the fastest ways to add motion and polish to a landing page, hero section, or auth screen.