No npm, no build step. One CDN script tag and a JSON file is all you need. Works in any HTML page, static site, or template engine.
Paste this into your <head> or just before the closing </body> tag.
<script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.9.6/lottie.min.js"></script>Give it a fixed size — Lottie will fill whatever dimensions you set.
<div id="lottie-icon" style="width: 150px; height: 150px;"></div>Point path at your downloaded JSON file. It autoplays and loops by default.
var anim = lottie.loadAnimation({
container: document.getElementById('lottie-icon'),
renderer: 'svg',
loop: true,
autoplay: true,
path: 'your_animation.json'
});Use the returned animation instance to pause, play, or stop whenever you need.
anim.pause();
anim.play();
anim.stop();Do I need npm?
No. The CDN script handles everything. You just need the script tag and a path to your JSON file.
Where do I put the JSON file?
Anywhere your server serves files. The path option works like an image src — relative paths, absolute paths, CDN URLs all work.
Will this work on a local file?
Not with file:// — Lottie fetches the JSON over HTTP. Use a local server (VS Code Live Preview, npx serve, etc.) while developing.
Get your animated icons
Browse icons ready for HTML — free to download.