Spinner
Nothing dropped or approximated
Free · Open source · MIT · v0.1.0
Write animations in HTML + CSS, get a Lottie JSON file.
css2lottie converts @keyframes, transitions and inline SVG into Lottie that
plays on the web, iOS, Android and Flutter. No After Effects needed.
npx css2lottie spinner.html -o spinner.json
No server, no account and no upload. A headless Chromium on your machine reads the animation.
Values come from the browser's own animation engine via the Web Animations API, frame by frame.
ease, ease-in-out and cubic-bezier() become one
Lottie keyframe with matching bezier handles, not 60 keys a second.
A report lists every unsupported or approximated feature, such as
box-shadow, filters or gradients.
All 11 animations below were converted by css2lottie v0.1.0 when this site was built. The left side is your browser playing the original CSS; the right side is lottie-web playing the generated JSON. Drag a slider to compare both on the same frame.
Nothing dropped or approximated
Nothing dropped or approximated
Nothing dropped or approximated
Nothing dropped or approximated
Nothing dropped or approximated
Nothing dropped or approximated
3D perspective: perspective: 600px3D transform-style: transform-style: preserve-3d3D transform: 3D transforms are flattened to 2D (no perspective); backface-visibility is respectedtext: "A" converted to shape outlines (not editable text)3D transform: 3D transforms are flattened to 2D (no perspective); backface-visibility is respectedtext: "B" converted to shape outlines (not editable text)Nothing dropped or approximated
Nothing dropped or approximated
text: "3" converted to shape outlines (not editable text)text: "L" converted to shape outlines (not editable text)text: "o" converted to shape outlines (not editable text)text: "t" converted to shape outlines (not editable text)text: "t" converted to shape outlines (not editable text)text: "i" converted to shape outlines (not editable text)text: "e" converted to shape outlines (not editable text)
Drop a .json Lottie here, such as one you just made with css2lottie, to play
it with lottie-web. The file stays in your browser and is never uploaded.
Conversion needs a real browser engine, so it runs on your computer through the npm package. Requires Node.js 18.17 or newer.
npm install --save-dev css2lottie
npx css2lottie install-browser
npx css2lottie input.html -o output.json --report
npx css2lottie input.html --preview
Opens a local page with the CSS and the Lottie side by side and a shared frame scrubber.
import { convertWithReport, formatReport } from "css2lottie";
const { lottie, report } = await convertWithReport({
file: "./animations/logo.html",
width: 400,
height: 400,
});
console.log(formatReport(report));
css2lottie is MIT-licensed and maintained in spare time. If it saves you an After Effects license or a designer round-trip, a coffee helps keep new CSS features coming.
Buy me a coffee
Run npx css2lottie animation.html -o animation.json. It loads the page in
headless Chromium, reads every CSS animation, transition and
element.animate() call, and writes Lottie JSON (Bodymovin 5.7+).
No. css2lottie builds the Lottie file straight from HTML and CSS.
In lottie-web, lottie-ios, lottie-android, React Native and Flutter, and on LottieFiles.
Not yet. Conversion needs a real browser engine, so it runs on your machine through the npm package or the CLI. This site plays the converted examples and previews any Lottie file you drop into the viewer.
box-shadow, filters, gradients, clip-path/masks,
stroke-dasharray and JavaScript-driven animation. The
--report flag lists everything that was dropped or approximated. See the
roadmap.