Comparing CSS left vs transform Animation Performance
A CSS animation that moves an element horizontally runs Layout and Paint on every frame when you use left. With transform, the main thread has almost nothing to do. I recorded two pages with the same motion for 3 seconds each in the Chrome DevTools Performance panel. Main thread time was about 800–970 ms for left and about 19–70 ms for transform. This difference is worth checking when you want to make a page with stuttering animations lighter, such as a slide-in menu or a moving background, or when the CLS (layout shift) value in Core Web Vitals is poor.
The test environment was Ubuntu 24.04 with Google Chrome for Testing 153.0.8010.12. It is a headless test environment with no display, so I ran Chrome on a virtual display (Xvfb) and operated DevTools with Playwright and xdotool. There is no GPU. The DevTools UI was in English. I did not apply CPU or network throttling (the default, No throttling). I did not test on a real smartphone, on regular Chrome with a GPU, or on Firefox and Safari.
The two pages compared
The test used a page with 200 boxes, each 60px wide and 20px high, arranged in a grid and moved 400px over 2 seconds. The left.html file is as follows.
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>left を動かす</title>
<link rel="icon" href="data:,">
<style>
body { margin: 0; font-family: sans-serif; }
.stage { position: relative; height: 480px; }
.box {
position: absolute;
width: 60px;
height: 20px;
background: #00c8e8;
border-radius: 4px;
animation: move 2s linear infinite alternate;
}
@keyframes move {
from { left: 0; } to { left: 400px; }
}
</style>
</head>
<body>
<p>left を動かすアニメーション(箱 200 個)</p>
<div class="stage" id="stage"></div>
<script>
const stage = document.getElementById('stage');
for (let i = 0; i < 200; i++) {
const box = document.createElement('div');
box.className = 'box';
box.style.top = (i % 20) * 24 + 'px';
box.style.marginLeft = Math.floor(i / 20) * 40 + 'px';
stage.appendChild(box);
}
</script>
</body>
</html>
transform.html is the same except for the @keyframes block, which is changed as follows. The only other differences are the <title> and the heading text.
@keyframes move {
from { transform: translateX(0); } to { transform: translateX(400px); }
}
I served both pages with python3 -m http.server 8080 and recorded them in the Performance panel with these steps. I opened the page, waited 2 seconds, pressed the Record button, waited 3 seconds, and pressed the Stop button. I recorded left and transform alternately, three times each.
Over a 3-second recording, main thread time differed by more than 10x
When I stopped a recording, the Summary tab at the bottom showed the time spent in each category during the recorded range. Purple is Rendering, which covers style calculation and Layout. Green is Painting. The three runs for each page were as follows.
| Rendering | Painting | Main thread time | |
|---|---|---|---|
left run 1 |
292 ms | 302 ms | 967.1 ms |
left run 2 |
334 ms | 320 ms | 854.2 ms |
left run 3 |
302 ms | 318 ms | 802.3 ms |
transform run 1 |
None | None | 19.0 ms |
transform run 2 |
None | None | 27.3 ms |
transform run 3 |
None | None | 69.8 ms |
Main thread time is the time spent on the main thread, shown in the table on the right side of the Summary tab. Every recording lasted 3.1–3.4 seconds. In the transform recordings, the Summary had no Rendering or Painting rows. It only showed System (18–69 ms) and Scripting (1 ms).
The third left recording looked like this. In the Overview strip at the top, the CPU graph shows purple and green peaks throughout the recording. In the Main row, thin tasks are lined up with no gaps.

The third transform recording looked like this. Except near the start of the recording, the CPU graph is almost flat. The Main row has only thin gray lines. Even so, the box positions change from frame to frame in the screenshot strip above, so the animation is running.

With left, Layout and Paint run every frame
To look inside the left recording, I dragged across the Overview strip to select about 120 ms and zoomed in. (This screen comes from a separate recording that I made only for zooming.) The Frames row shows 16.7 ms frames, and the Main row shows tasks for each frame.

When I zoomed in to a single frame, the main work under the task appeared in this order. (The third item is cut off on screen as "Pre…int".)
- Recalculate style (purple)
- Layout (purple)
- Pre…int (purple)
- Paint (green)
- Commit
The main thread time for this frame was 3.1 ms. When I clicked Layout and Paint, the Summary tab showed the following.

Layout
Duration 0.21 ms (self 13 μs)
Layout root #document
Paint
Duration 1.15 ms (self 0.29 ms)
On this test page, one Layout took a short 0.21 ms, and Paint took longer. Each one is small, but as the Frames row shows, they repeat every 16.7 ms (about 60 times per second) for as long as the animation runs. That is why a 3-second recording adds up to several hundred milliseconds, as the table above shows.
The MDN page on animation performance and frame rate explains the steps a browser takes to show an animation on screen, in this order: style recalculation, Layout (calculating element position and size), and Paint. Changing properties that affect an element's position or size, such as left, triggers all three steps. The order of processing in the recording matched this explanation.
With transform, the main thread is almost idle
For the transform recording, I also selected about 100 ms and zoomed in. The Main row has only occasional thin vertical lines. The main thread time for this range was 0.2 ms. The Frames row showed nothing in this range.

According to the same MDN page, when transform or opacity is applied to an element drawn on its own layer, changing them does not trigger Layout or Paint. The screen is updated during the Composition step, which stacks the layers. A web.dev article recommending compositor-only properties also recommends changing transform and opacity for animations. The transform page showed no Painting time in the recording, which matches this explanation. MDN says style recalculation still happens, but the recording showed no Rendering time either.
The left animation also counts toward CLS
In the left recording, a Layout shifts row appeared above the Main row, with purple diamonds lined up in it. The Insights tab on the left also showed CLS 0.15 for the first left recording. The transform recording had no Layout shifts row.
I also compared CLS values on the Live metrics screen, which appears first when you open the Performance panel. I opened each page and waited 5 seconds.

The left page had a CLS of 0.24, which was labeled "needs improvement". The transform page had a CLS of 0. The web.dev CLS documentation says that transform lets you move an element without causing layout shifts. It recommends avoiding changes to top, right, bottom, and left when moving elements, and using transform: translate() instead.
CLS is one of the Core Web Vitals metrics. In the test pages, the Layout shifts row in the left recording had diamonds at nearly the same interval as the frames, and each one counted as a layout shift for as long as the element was moving. The transform page, which looked the same, kept a CLS of 0.





