SMIL vs CSS animation for SVG
An SVG has two built-in, declarative ways to move. SMIL is an XML vocabulary baked into the SVG spec; CSS animation borrows the page's stylesheet engine and applies it to SVG elements. People treat them as rivals, but most production files mix both — the honest question is which engine fits each job. This guide compares them on the things that actually break in production: support, timing, path motion, triggers, coordinate systems and how each one survives being embedded.
1. What each engine looks like
SMIL (Synchronized Multimedia Integration Language) puts animation inside the graphic as elements: <animate> for attributes and properties, <animateTransform> for translate/scale/rotate/skew, <animateMotion> for movement along a path, <animateColor> and the one-shot <set>. Each is a child of the element it animates, carrying attributes such as attributeName, begin, dur, values, keyTimes and repeatCount. The file stays a single, portable unit — copy the SVG somewhere and the timing travels with it.
CSS animation lives in a <style> block (or an inline style="" attribute) and targets SVG elements with ordinary selectors: classes, ids, element names. A @keyframes block defines the property states, and an animation shorthand on the rule sets duration, easing, delay and iteration. If you already write CSS for a web page, there is almost nothing new to learn — the novelty is only which SVG properties are animatable.
2. Browser support in 2026
The persistent myth is that SMIL is dead. The SMIL specification was indeed marked deprecated years ago, and Chrome once announced a removal that never happened. Today every current engine — Blink (Chrome, Edge), WebKit (Safari) and Gecko (Firefox) — still ships its native SMIL implementation, and there is no credible removal path because nothing else replaces animateMotion without JavaScript. The checker's own FAQ states this plainly, and the test suite on the homepage includes SMIL fixtures that play identically in all three engines.
CSS animation on SVG elements is equally universal, with one historical caveat: very old WebKit builds required -webkit- prefixes on keyframes. Any browser still in support in 2026 handles unprefixed CSS animation. In practice both engines have the same desktop support floor; the difference is ecosystem momentum, not compatibility.
3. The timing models compared
SMIL timing is attribute-based and explicit. dur="2.4s" sets duration, begin="1.5s" sets delay, repeatCount="indefinite" means loop forever, and fill="freeze" holds the final state. Multi-stop motion uses parallel lists: values="20;40;20" with keyTimes="0;0.5;1" and optional keySplines for per-segment cubic easing, while calcMode selects linear, discrete, spline or paced interpolation. Events and even other animations' begin/end times can drive begin, which gives SMIL a small synchronization language of its own.
CSS timing is shorthand-based: animation: dash 1.6s ease-in-out 0.2s infinite packs name, duration, easing, delay and iteration into one declaration. Keyframe stops use percentages (0%, 50%, 100%) rather than normalized keyTimes, and one timing function applies per segment or per animation unless overridden inside individual keyframes. The model is simpler for designers to read, but synchronizing one animation to another's end requires either matching durations by hand or orchestrating everything in JavaScript — SMIL's begin="otherAnim.end" has no pure-CSS equivalent.
4. Motion along a path
This is SMIL's unique stronghold. <animateMotion> with a child <mpath> referencing a <path> sends any element along that exact curve, including automatic rotation when you ask for it. The homepage sample 01-path-motion.svg moves two balls along a Bézier track with two elements and no code. CSS gained offset-path (formerly motion-path) to close this gap, and modern engines support it — but support is younger, the syntax is still settling, and it cannot travel an existing SVG path's geometry as tersely as mpath. If your graphic is exported from a design tool or must run in an <img> without page CSS, SMIL path motion remains the reliable, self-contained choice.
5. Triggers and interactivity
SMIL understands DOM events natively: begin="go.click" starts the animation when the element with id="go" is clicked, and begin="go.mouseover" handles hover. The 06-click-trigger.svg fixture on the homepage uses exactly this pattern and reports an informational "waiting for a trigger" diagnostic, because nothing plays on load. CSS instead leans on pseudo-classes — :hover, :active, :focus — and on class toggles controlled by page JavaScript. CSS wins when the animation is really application state (open/close, selected/unselected) that already lives in the DOM; SMIL wins for self-contained interaction inside a graphic that may be shipped as a standalone file.
6. Transform origins and the fill-box trap
The single most common CSS-on-SVG bug is rotation around the wrong point. HTML boxes measure transforms from their border box; SVG elements historically measure transform-origin against the SVG viewport's coordinate system, so a spinner written like a CSS loader rotates around the corner of the whole canvas instead of its own center. The fix is transform-box: fill-box; plus transform-origin: center; on the animated SVG element — you can see this pair in the CSS loader sample and in the pop-in check mark of the animated check mark gallery. SMIL's animateTransform takes its center as explicit rotate arguments (rotate(angle cx cy)), which is more verbose but never inherits a surprising origin from the surrounding layout.
7. Embedding, CSP and sanitizers
Both declarative engines survive the restrictive <img> context, which blocks scripts but continues to run SMIL and CSS animations — that is why every downloadable tick in the check mark gallery uses only those two engines. The divergence appears under hardening: a Content-Security-Policy with style-src 'self' and no 'unsafe-inline' strips an inline <style> block, silently deleting CSS keyframes, whereas SMIL attributes are markup rather than style and are unaffected by style directives. Conversely, some SVG sanitizers in CMS and email pipelines have historically stripped unfamiliar SMIL tags more aggressively than well-known CSS. Know the pipeline the file will travel; when a graphic freezes after deployment, the embedding guide on SVG animation not working in an img tag walks through the full matrix.
8. Debugging and the decision framework
CSS animations are inspectable in DevTools: the Animations panel scrubs timelines and shows computed keyframes, and a typo in animation-name is at least visible as a missing timeline. SMIL historically had thinner tooling, which is why a dedicated parser that reads the XML and lists each <animate> with its begin, duration and repeat count is the fastest way to audit it. The SVG Animation Checker normalizes both engines into one table and one timeline, and applies the same validation rules — missing duration, unmatched keyframes, dead selectors, keyTimes/values count mismatches — regardless of which language the file uses.
The decision framework is short. Choose SMIL when the SVG must be self-contained, when motion follows a path, when animations must chain on each other's timing, or when a strict CSP might remove inline styles. Choose CSS when the motion is driven by page state and pseudo-classes, when designers already maintain a design system in CSS, or when you want DevTools' native animation tooling. Avoid JavaScript-driven SVG animation when the file will be embedded in <img> or passed through a sanitizer — and when a file that used to move stops moving, the triage guide on why your SVG animation is not working covers every silent failure in the order they are fastest to check.