# CSS vs JavaScript Animation Performance Comparison

Which method is more efficient? Exploring main thread impacts.

- **Source:** [Josh Comeau](https://www.joshwcomeau.com)
- **Published:** 2026-05-26
- **Topic:** [Software & Engineering](https://brifing.si/c/engineering)
- **Original article:** <https://www.joshwcomeau.com/animation/css-vs-javascript/>
- **On Brifing:** https://brifing.si/s/1379ffd8-1b5e-428c-b129-587193259c89

## Introduction to Animation Performance

Performance differences between CSS and JavaScript animations are particularly crucial in complex web applications. Contrary to conventional wisdom, modern browser engines can efficiently process JavaScript calculations. However, the real difference lies in which thread the animations run on.

## Advantages of CSS Keyframes

CSS animations run on a separate thread, making them immune to congestion in the main JavaScript thread. This provides a distinct advantage in applications using frameworks like React that constantly update the DOM or perform data fetching operations.

## Limitations of JavaScript Animations

Although JavaScript-based animations use requestAnimationFrame, they compete for resources with other tasks on the main thread. This can cause animations to freeze or appear jumpy, especially on low-power devices.

## Web Animations API (WAAPI)

Modern libraries like Motion leverage the Web Animations API to bring CSS animation advantages to JavaScript. This enables the creation of performant animations that run on a separate thread.

## Strengths of GSAP

Traditional JavaScript animation libraries like GSAP offer advanced features incompatible with WAAPI. Preferred for complex animation scenarios, these libraries provide flexibility through different technical trade-offs.

## Choosing the Right Tool

Modern CSS with new APIs like View Transitions and Animation Timeline can meet many animation needs without JavaScript. For complex cases, WAAPI-supported libraries enable advanced animations without performance penalties.

## Sources covering this story

- https://www.joshwcomeau.com/animation/css-vs-javascript/ — 

---

_Summary written by Brifing from the original reporting. Copyright in the original article belongs to its publisher; read the full piece at the link above._
