How to get the best image performance (Updated 2021)

1️⃣ Use `width` and `height` to prevent layout shift
2️⃣ Lazy-load images as they enter the viewport
3️⃣ Use modern image formats (WebP, AVIF)
4️⃣ Serve correctly sized images using `srcset`
5️⃣ Provide blur-up placeholders

1️⃣ Use `width` and `height` to prevent layout shift

These image attributes tell the browser how much space to allocate for an image, preventing the page from jumping when it loads. This avoids Cumulative Layout Shift (CLS).

https://t.co/KUyqGsxOoN
2️⃣ Lazy-load images as they enter the viewport

The browser shouldn't load images a user can't see. To prevent page speed from being penalized, we should load images as they're scrolled into the viewport.

https://t.co/rpjyg0YXsU
3️⃣ Use modern image formats (WebP, AVIF)

These new formats reduce image file size while retaining quality. WebP is supported by all modern browsers. AVIF should be soon, too.

https://t.co/TiNwEwGQNc
4️⃣ Serve correctly sized images using `srcset`

The browser should choose the best image for the device. By providing multiple options, we avoid shipping large images to smaller viewports.

https://t.co/7FaQ8s72sp
5️⃣ Provide blur-up placeholders

Improve the user experience of loading large images by showing a blurred placeholder while loading. This prevents an extra network request to fetch a thumbnail image, too.

This also improves Largest Contentful Paint.

https://t.co/g3NDzUH1ue
The first four optimizations above are handled automatically with `next/image`. Blur-up placeholders coming soon.

https://t.co/BCfEj1mKeI
Some other frameworks/providers with optimized images:

@eleven_ty: https://t.co/0X5OPDU1Fk
@gatsbyjs: https://t.co/YRfCxRDvZ5
@sanity_io: https://t.co/un7ZpdbZai
@datocms : https://t.co/tx2qy4Kbub

Let me know others I'm missing!
If you found this helpful, you might also enjoy optimizing your web fonts.

https://t.co/TNAXslHQjd

More from For later read

1. The death of Silicon Valley, a thread

How did Silicon Valley die? It was killed by the internet. I will explain.

Yesterday, my friend IRL asked me "Where are good old days when techies were


2. In the "good old days" Silicon Valley was about understanding technology. Silicon, to be precise. These were people who had to understand quantum mechanics, who had to build the near-miraculous devices that we now take for granted, and they had to work

3. Now, I love libertarians, and I share much of their political philosophy. But you have to be socially naive to believe that it has a chance in a real society. In those days, Silicon Valley was not a real society. It was populated by people who understood quantum mechanics

4. Then came the microcomputer revolution. It was created by people who understood how to build computers. One borderline case was Steve Jobs. People claimed that Jobs was surrounded by a "reality distortion field" - that's how good he was at understanding people, not things

5. Still, the heroes of Silicon Valley were the engineers. The people who knew how to build things. Steve Jobs, for all his understanding of people, also had quite a good understanding of technology. He had a libertarian vibe, and so did Silicon Valley

You May Also Like

Department List of UCAS-China PROFESSORs for ANSO, CSC and UCAS (fully or partial) Scholarship Acceptance
1) UCAS School of physical sciences Professor
https://t.co/9X8OheIvRw
2) UCAS School of mathematical sciences Professor

3) UCAS School of nuclear sciences and technology
https://t.co/nQH8JnewcJ
4) UCAS School of astronomy and space sciences
https://t.co/7Ikc6CuKHZ
5) UCAS School of engineering

6) Geotechnical Engineering Teaching and Research Office
https://t.co/jBCJW7UKlQ
7) Multi-scale Mechanics Teaching and Research Section
https://t.co/eqfQnX1LEQ
😎 Microgravity Science Teaching and Research

9) High temperature gas dynamics teaching and research section
https://t.co/tVIdKgTPl3
10) Department of Biomechanics and Medical Engineering
https://t.co/ubW4xhZY2R
11) Ocean Engineering Teaching and Research

12) Department of Dynamics and Advanced Manufacturing
https://t.co/42BKXEugGv
13) Refrigeration and Cryogenic Engineering Teaching and Research Office
https://t.co/pZdUXFTvw3
14) Power Machinery and Engineering Teaching and Research