Two formats exist for Lottie animations: the original .json (Lottie JSON) and the newer .lottie (dotLottie). They render identically in the browser â but one is dramatically smaller. Here's when to use each, and how to switch.
TL;DR
-
.jsonâ use when maximum tooling compatibility matters (older projects, plugins that don't support dotLottie yet) -
.lottieâ use for everything else. 75% smaller, faster, supports multiple animations per file
What Is Lottie JSON?
.json is the original format, introduced by Airbnb's Bodymovin After Effects plugin in 2015. It's plain text JSON describing every layer, shape, keyframe, and property in the animation.
Example size: A 3-second loading spinner â ~25KB
Because it's plain JSON:
- Human-readable
- Universal support across all Lottie libraries
- Can be edited with a text editor or a tool like IconKing
What Is dotLottie (.lottie)?
.lottie is a ZIP archive (renamed) containing the Lottie JSON plus any assets (images, fonts). It was introduced by LottieFiles in 2022.
Same 3-second spinner: ~7KB (72% smaller)
Additional features over .json:
- Multiple animations in a single file (scenes)
- Embedded fonts/images in one container
- Metadata (author, description, version)
- Background color and loop settings baked in
Size Comparison
These are real-world examples:
| Animation | .json |
.lottie |
Savings |
|---|---|---|---|
| Loading spinner | 24KB | 6KB | 75% |
| Success checkmark | 18KB | 5KB | 72% |
| Hero illustration | 145KB | 38KB | 74% |
| Icon set (5 icons) | 92KB | 24KB | 74% |
The compression is consistent regardless of animation complexity.
Converting Between Formats
IconKing converts .json â.lottie in the browser:
- Go to iconking.net
- Drop your file onto the page
- Click the convert button
- Download the new format
No account, no upload limit, fully client-side. The converted file is byte-for-byte identical in visual output to the original.
Library Support Comparison
| Library | .json |
.lottie |
|---|---|---|
| lottie-web | â | â |
| lottie-react | â | â |
| vue3-lottie | â | â |
| @lottiefiles/dotlottie-web | â | â |
| @lottiefiles/dotlottie-react | â | â |
| @lottiefiles/dotlottie-vue | â | â |
| lottie-android | â | â (v2.0+) |
| lottie-ios | â | â (v4.0+) |
Key insight: To use .lottie on web, you need to switch from lottie-web/lottie-react to the @lottiefiles/dotlottie-* libraries. The switch is a one-time migration â APIs are similar.
Migrating: lottie-react â dotlottie-react
Before (lottie-react, .json):
npm install lottie-react
import Lottie from 'lottie-react';
import animData from './animation.json';
<Lottie animationData={animData} loop autoplay />
After (@lottiefiles/dotlottie-react, .lottie):
npm uninstall lottie-react
npm install @lottiefiles/dotlottie-react
import { DotLottieReact } from '@lottiefiles/dotlottie-react';
<DotLottieReact
src="/animations/animation.lottie"
loop
autoplay
/>
Key differences:
-
animationDataprop âsrcprop (URL string, not JSON object) - Place
.lottiefiles inpublic/animations/instead of bundling them
Migrating: Vue
Before (vue3-lottie, .json):
<Vue3Lottie :animationData="animData" />
After (@lottiefiles/dotlottie-vue, .lottie):
npm install @lottiefiles/dotlottie-vue
<DotLottieVue src="/animations/animation.lottie" :loop="true" :autoplay="true" />
Migrating: Vanilla JS
Before (lottie-web, .json):
lottie.loadAnimation({
container: el,
animationData: require('./animation.json'),
renderer: 'svg'
});
After (@lottiefiles/dotlottie-web, .lottie):
npm install @lottiefiles/dotlottie-web
import { DotLottie } from '@lottiefiles/dotlottie-web';
const dotLottie = new DotLottie({
canvas: document.getElementById('canvas'), // Note: requires <canvas>, not <div>
src: '/animations/animation.lottie',
loop: true,
autoplay: true,
});
One important difference: dotlottie-web requires a <canvas> element, not a <div>.
When to Stick With .json
- You use lottie-web/lottie-react directly and don't want to swap libraries yet
-
Designer tools like Adobe After Effects + Bodymovin export
.jsonnatively; no friction -
Older plugin ecosystem â some CMS plugins (WordPress Lottie plugins) only support
.json -
Programmatic manipulation â editing colors via
addValueCallbackonlottie-webworks with.json; dotLottie has different APIs for this
When to Use .lottie
- New projects â no legacy to worry about
- Mobile apps â 75% smaller files = meaningful bandwidth savings on LTE/3G
-
Multiple animations â bundle a full icon set into one
.lottiefile - Core Web Vitals â smaller files = better LCP scores
- CDN serving â less transfer cost
dotLottie Programmatic API
The @lottiefiles/dotlottie-web API is slightly different from lottie-web:
const dotLottie = new DotLottie({ canvas, src, loop: true, autoplay: true });
// Playback
dotLottie.play();
dotLottie.pause();
dotLottie.stop();
dotLottie.setSpeed(1.5);
dotLottie.setLoop(true);
// Events
dotLottie.addEventListener('play', () => console.log('playing'));
dotLottie.addEventListener('complete', () => console.log('done'));
dotLottie.addEventListener('frame', ({ currentFrame }) => {});
// Cleanup
dotLottie.destroy();
Multiple Animations in One .lottie File
This is the killer feature of dotLottie for icon sets:
const dotLottie = new DotLottie({
canvas,
src: '/animations/icons.lottie', // contains 10 icons
loop: false,
autoplay: false,
});
// Switch to a specific animation by name
dotLottie.loadAnimation({ animationId: 'icon-success' });
dotLottie.play();
Ship a full animated icon library as a single 30KB file instead of 10 separate 15KB files.
Workflow Recommendation
For new projects:
- Get
.jsonfrom LottieFiles or your designer - Preview and edit colors in IconKing
- Convert to
.lottiein IconKing - Install
@lottiefiles/dotlottie-react(or vue/web) - Use
src="/animations/file.lottie"â done
For existing projects:
- Keep
.jsonworking (don't break things) - Convert each file to
.lottieat IconKing - Migrate components one by one from
lottie-reactâdotlottie-react - Remove
lottie-reactonce fully migrated
Summary
.json |
.lottie |
|
|---|---|---|
| File size | Larger | ~75% smaller |
| Web library | lottie-web, lottie-react | @lottiefiles/dotlottie-* |
| Compatibility | Universal | Growing (all major platforms) |
| Multiple animations | No | Yes |
| Editing tools | All Lottie tools | IconKing, LottieFiles |
| Best for | Legacy projects, CMS plugins | New projects, mobile, performance |
If you're starting fresh: use .lottie. Convert existing files at IconKing when you're ready to migrate.
Top comments (0)