Optimize images in React (video tutorial)
Last updated: Feb-23-2026
Overview
Unoptimized images are a leading cause of performance problems on websites, resulting in slow loading times that frustrate users and hurt conversion rates. This tutorial demonstrates how to use the Cloudinary React SDK to automatically optimize images with format and quality transformations, and resize them to match your UI requirements. Learn how to reduce image file sizes from megabytes to kilobytes while maintaining visual quality.
For more information on image optimization techniques, see the image optimization guide. To learn about React SDK configuration, see React integration.
Video tutorial
This video is brought to you by Cloudinary's video player - embed your own!
Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.
Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
Introduction
| Unoptimized images are a leading cause of performance problems on websites. Slow loading websites frustrate users and hurt conversion rates. Learn how Cloudinary's React SDK makes it easy to optimize images automatically. |
Demo application
| See a demo application that loads images from the local machine. These images are completely unoptimized, resulting in huge file downloads that slow down the website. |
Configuring the Cloudinary SDK
| Change the image source attribute to point to Cloudinary instead of the local machine. The images are already uploaded to Cloudinary in their original file size, ready to be optimized. See how to configure the React SDK in your application. |
Adding format and quality optimization
Use the Cloudinary React SDK's advanced image component and chain on optimization parameters. Add the format('auto') method to let Cloudinary automatically choose the best format (WebP, JPEG, PNG) for the browser. Add the quality('auto') parameter to let Cloudinary determine the optimal quality setting. |
Restricting image dimensions
Further optimize by restricting the image size to match your UI requirements. Use the resize() method with the scale() parameter to set a maximum width of 400 pixels, ensuring users only download images sized appropriately for display. |
Results
| See the dramatic improvement: images reduced from 4 megabytes to just 10-20 KB. All images are served in WebP format, the most efficient format for the browser. The page looks just as good but loads much faster, providing a better user experience. |
Keep learning
- Read our image optimization guide to learn about delivering your images more efficiently.
- Take a look at our React SDK for more image transformations.
- Watch more Dev Hints videos on the Cloudinary YouTube channel.
If you like this, you might also like...
Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.
