Animated SVG on product sites.

An animated SVG is an SVG with moving parts. Motion can come from CSS inside the file, SMIL or JavaScript. This guide uses CSS-based illustrations: they stay sharp when scaled and need no animation player. Inline SVG can also follow your page's colours and expose playback controls.

What an animated SVG is

An SVG is shapes, lines and text that the browser draws at any size. Add CSS keyframes inside it and parts of it move: a packet travels a wire, a gauge fills, a queue moves up one.

Because it is code, it can use your site's colours, switch with your light and dark modes, and show a still frame to people who ask for less motion.

When to use an icon, a still or animation

I would use an icon when the idea is familiar and the space is small. A still illustration can show the parts. Animation is worth trying when a step or relationship becomes easier to follow as it moves. The still version should make sense too.

Kestrel, a fictional demo product I made, has a feature called "A thousand runs, one queue". That is demo copy, not a performance result. The live section uses a different illustration. For this comparison, I would keep the section and its words fixed, then change only the illustration.

The example uses Queue, a free Isometric illustration from Illos, which I made. Jobs wait in a line, and a worker takes the next one in. It is a teaching replacement, not the illustration already on Kestrel.

Icon
Still
Animation
The same queue feature with an icon, a still and the free Queue illustration. These are teaching replacements, not three shipped versions.

An icon labels the idea

If the heading says "Queue" and the reader knows what a queue is, a small icon may be enough. That works in a compact feature list. It identifies the subject without asking people to inspect a scene.

It does not show much about how this queue works. That only matters if explaining the process is the job of this section. More detail is not automatically better.

A still shows the parts

The still version shows jobs waiting on a belt and the worker at the end. If the point is to explain the layout, I would stop there. The text beside it can explain what happens next.

A still is also the version that needs to work before playback and when motion is turned off. Keep the heading and explanation visible instead of putting the whole meaning into movement.

Animation makes a step easier to follow

In Queue, a job moves into the worker and its indicator changes. The line moves up. That change from waiting to being worked on is the part I would use motion to explain.

The free SVG file contains CSS animation with a 3.2-second duration and one iteration. It also includes a reduced-motion layout. The SVG does not need an animation player to run. Controls on the surrounding page are a separate implementation detail.

For this comparison, I would start still and offer visible Play, Pause and Replay controls. With reduced motion enabled, keep the understandable still layout. Check the result in the browser rather than assuming that a media query makes the whole section accessible.

Motion can also be there because it feels good. That can be fine. Here I am asking a narrower question: does seeing the job move help explain this queue, or was the still enough?

Try the choice on your own section

Write one sentence saying what the reader should understand. Compare the icon, still and animation beside the same heading and paragraph. Check them at phone width. If motion adds nothing useful to this explanation, the still may be the better choice.

The free illustration can be used and changed in personal or commercial work under the Illos licence. Keep the comparison about one section. It is not a suggestion to mix unrelated illustration styles across your site.

SVG with animation: three ways to add the motion

  • CSS keyframes inside the file. No script, one media query gives a still frame to people who ask for less motion, and it plays even when the SVG is loaded as an image. The best default for illustrations.
  • SMIL uses SVG animation elements such as <animate> and <animateTransform>. It is also free of script and supported in current browsers. CSS animation controls do not directly control a SMIL timeline, so provide explicit playback and reduced-motion handling if you choose it.
  • JavaScript, with the Web Animations API or a library such as GSAP. Use it when motion follows scrolling or clicks. It adds a script that has to load before anything moves.

How to animate an SVG with CSS

Give each moving part a class, write keyframes in a <style> block inside the SVG, and set transform-origin to the point a part turns around. This one spins a fan and pulses a light:

<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
  <style>
    .fan { transform-origin: 60px 60px; animation: spin 2s linear infinite; }
    .led { animation: pulse 1.6s ease-in-out infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes pulse { 50% { opacity: 0.3; } }
    @media (prefers-reduced-motion: reduce) { * { animation: none; } }
  </style>
  <circle cx="60" cy="60" r="40" fill="none" stroke="currentColor" stroke-width="3" />
  <path class="fan" d="M60 60V34M60 60l22 13M60 60L38 73" stroke="currentColor" stroke-width="6" stroke-linecap="round" />
  <circle class="led" cx="102" cy="18" r="5" fill="#3fdec9" />
</svg>

Start with transform and opacity. They are usually cheap for the browser to redraw, but that is a starting point, not a promise of smooth motion on every phone. Check it on a real one. To send something along a line, animate stroke-dashoffset on a dashed path.

Move things the way the real thing would: a fan spins while the machine runs, a queue moves up when one item leaves. Motion that follows the idea explains it; motion for its own sake is noise.

Three ways to put an animated SVG on a page

  • As an image: <img src="queue.svg" alt="...">. The simplest. It animates, but it cannot read your page's colours and you cannot pause it from the page.
  • Inline: paste the <svg> into your HTML. It can follow your theme's colours, and your page can pause it.
  • As a React component: the inline SVG, packaged so you write <IllosQueue /> where you want it.
npx shadcn@latest add https://illos.dev/r/isometric/queue.json

That command adds a free Illos illustration to a React project as a component, ready to place.

How big is an animated SVG file?

An illustration that moves with CSS is a small text file. These are the Illos themes, measured compressed, the way a browser downloads them:

ThemeIllustrationsFile size
Shader412.6 to 11.7 KB compressed
HUD312.4 to 24.2 KB compressed
Isometric644.2 to 19.8 KB compressed
Interface442.2 to 11.4 KB compressed

A GIF or a video of the same scene is larger and blurs when it is scaled up. The file size test puts them side by side.

Respect reduced motion, and pause it off screen

Some people turn on reduced motion in their system settings. Give them the still frame:

@media (prefers-reduced-motion: reduce) {
  .illo * { animation: none !important; }
}

An illustration nobody can see has no reason to move. Pause it when it scrolls away:

const svg = document.querySelector(".illo");
new IntersectionObserver(([entry]) => {
  svg.style.setProperty("--play", entry.isIntersecting ? "running" : "paused");
}).observe(svg);

/* in the SVG's CSS */
.illo * { animation-play-state: var(--play, running); }

The free Queue SVG includes its own reduced-motion layout. Pausing when it leaves the viewport is behaviour of the surrounding component or page, so check the integration you use.

Keep one style across the site

One illustration is easy. The tenth is where sites fall apart: a different line weight, a different palette, a different idea of what moves. Ask a coding agent for illustrations on two different days and you get two different hands.

Illos solves that with themes. Each theme has a library to start from and skills that teach any coding agent its rules, so the illustration it makes next month matches the one you added today.

Start with a free one

The 87 free animated SVG illustrations work in personal and commercial projects, with no credit and no account. Copy the SVG, or add one as a React component. The library has all 200.

Browse free illustrations

Questions

Anything else? Write to hello@illos.dev.

How do I animate an SVG?

Put CSS keyframes in a <style> block inside the SVG and give the moving parts a class. Animate transform and opacity, and add a prefers-reduced-motion rule so people who ask for less motion see a still frame.

Does an animated SVG play in an img tag?

Yes. CSS and SMIL animation inside the file play when it is loaded with <img>. A script inside the file does not run, and the page cannot restyle it, so paste it inline when it should follow your theme.

Does an animated SVG need a script to play?

Not when its motion is written in CSS or SMIL inside the SVG. An inline page can use JavaScript for controls or viewport behaviour. A JavaScript-driven animation needs its script.

SVG or Lottie?

Lottie plays animations exported from After Effects through a player library. An SVG with CSS animation needs no player and can follow your page's colours. For illustrations that explain an idea, plain SVG is usually the lighter choice.

Will it look sharp on a large screen?

Yes. An SVG is drawn at whatever size it is shown, so it is crisp on every screen.

Is a static illustration a lesser version of an animation?

No. If seeing the parts explains the idea, a still can do the whole job. Movement is another option, not an upgrade every section needs.

Does adding a play button make the SVG need a player?

No animation player library is needed for this CSS SVG. The surrounding page may use JavaScript for playback controls. That is different from needing a player to render the illustration.