What is an animated gradient background?
An animated gradient background is a color blend that moves slowly behind your content. It adds life to a hero section, a landing page or a slide without a video file. This animated gradient background generator shows the result as you change it and gives you plain CSS code that you can paste into any site.
How to use the animated gradient generator
- Pick a preset, or start with your own colors.
- Choose Linear, Radial or Blobs.
- Set the angle, the speed, the blur and the grain.
- Open CSS code and press Copy CSS. Paste it into your stylesheet and add the class to your element.
- Or open PNG and download a still, or open Video and record one loop.
How the CSS works
The code uses a pseudo-element (::before) that sits behind your content. The gradient is drawn larger than the element, and a CSS animation moves it slowly from one side to the other and back. Because the moving part is a separate layer, blur only touches the background, never your text. When grain is on, a second layer (::after) adds a fine noise texture.
The code also has a prefers-reduced-motion rule. People who ask their device for less motion see a still gradient. This matters for people who get dizzy from moving backgrounds.
Linear, radial or blobs
- Linear blends colors along a line at the angle you choose. It suits wide hero sections.
- Radial blends colors out from a center point. It suits cards and square areas.
- Blobs places soft circles of color on a base color and moves each one on its own path. With some blur, it gives the soft "mesh gradient" look.
Grainy gradients
Grain is a light noise texture on top of the colors. It makes flat gradients look softer and more like print. It also hides banding, the visible steps that can show in smooth gradients on some screens. Start at 10 to 20 percent. More grain looks bold, but it makes video files much larger, because noise is hard to compress.
Tips for a good background
- Keep text readable. Turn on "Show text on top" and check that your headline is easy to read over every part of the loop.
- Slow is calm. A loop of 12 to 20 seconds feels relaxed. Very fast loops pull attention away from your content.
- Use two to four colors that sit near each other on the color wheel for a soft look, or far apart for a bold look.
- One moving background per page is enough.
PNG and video
The PNG option saves one still frame at common sizes, such as 1920 x 1080 for a hero image or 1080 x 1920 for a phone wallpaper. Use the Frame slider to pick the moment.
The video option records one full loop, so it repeats without a jump. Your browser makes the video on your device. Most desktop browsers can make WebM, and some can also make MP4. If your browser cannot record video, the page tells you, and the CSS and PNG still work.
Performance
A CSS gradient animation is light. It needs no image or video download. Blur on a large area costs more work for the device, so use it with care on pages that already do a lot. The reduced-motion rule turns the animation off for people who ask for it.