Skip to main content
Lottie4 min readNovember 2026

Why does my Lottie animation have large padding, and how do I remove it?

Short answer

The padding comes from the After Effects composition size, which is saved in the file as its width and height. The cleanest fix is to crop the composition to the artwork in After Effects and export again. If you cannot, scale the player instead: use preserveAspectRatio "xMidYMid slice" on the web, centerCrop or a scale on Android, and scaleAspectFill on iOS.

Core Takeaway

  • Lottie keeps the full composition canvas, including empty space
  • Best fix: crop the comp to the artwork and re-export
  • Web: rendererSettings.preserveAspectRatio "xMidYMid slice"
  • Android: scaleType centerCrop or a scale factor
  • iOS: contentMode .scaleAspectFill

Lottie draws the whole composition, not just the visible shapes. If the designer drew a 64 px icon in a 500 x 500 comp, the file is 500 x 500 with a lot of empty space, and your layout gets that space too.

Fix it at the source

In After Effects, use the Region of Interest tool to draw a box around the artwork, then Composition > Crop Comp to Region of Interest. Leave a few pixels so nothing is clipped when it scales or overshoots, then export again. This also makes the file easier for other developers to use.

Without After Effects, you can edit the JSON: the top-level w and h are the canvas size. Changing them alone moves the artwork off-centre, so you would also need to shift the layers, which is fiddly. An editor such as LottieFiles Lottie Creator is easier.

Fix it in the player

lottie.loadAnimation({
  container,
  renderer: 'svg',
  path: '/icon.json',
  rendererSettings: { preserveAspectRatio: 'xMidYMid slice' }
});

You can also put the player in a fixed-size container with overflow hidden and scale it up with CSS transform. On Android, set scaleType to centerCrop or set a scale on the LottieAnimationView. On iOS, set contentMode to .scaleAspectFill and clip to bounds.

Player-side fixes crop the drawing, so test at every size you use. Cropping the comp is the only fix that changes the file itself.

Frequently asked questions

Can I remove Lottie padding with CSS only?

You can hide it by scaling the player inside a container with overflow hidden. The file still contains the empty canvas.

What does preserveAspectRatio slice do?

It scales the drawing to fill the container and crops what overflows, like background-size: cover.

Will cropping the comp break the animation?

Only if shapes move outside the new bounds. Scrub the whole timeline after cropping and leave a margin.

Can I trim a Lottie without After Effects?

Yes. Browser editors such as Lottie Creator can change the canvas and trim frames.

Related Guides & Examples

Design with layout from the start

ExodeUI has UI layout built in, so animated components size to their content.

Open the editor
ExodeUI

EXODEUI DESKTOP

A little space for good ideas.

Choose your platform to get the official ExodeUI installer.

Looking for Intel Mac or other builds? Explore the web studio or check all download options.

Prefer the browser? Try for free in your browser →