Limited offer — lifetime access:$75$60
Lottie · HTML

Using Lottie icons in HTML

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.

1

Add the CDN script

Paste this into your <head> or just before the closing </body> tag.

HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.9.6/lottie.min.js"></script>
2

Add a container div

Give it a fixed size — Lottie will fill whatever dimensions you set.

HTML
<div id="lottie-icon" style="width: 150px; height: 150px;"></div>
3

Load your animation

Point path at your downloaded JSON file. It autoplays and loops by default.

JS
var anim = lottie.loadAnimation({
  container: document.getElementById('lottie-icon'),
  renderer: 'svg',
  loop: true,
  autoplay: true,
  path: 'your_animation.json'
});
4

Control playback

Use the returned animation instance to pause, play, or stop whenever you need.

JS
anim.pause();
anim.play();
anim.stop();

Common questions

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.

Browse icons