How to Prepare Images for a Faster WordPress Site
Images are often the heaviest part of a web page. A photo taken with a phone can weigh several megabytes, and a page with a few of them loads slowly, especially on a mobile connection. Preparing images properly is one of the easiest ways to speed up your site.
Why images slow pages
A browser must download every image before the page feels complete. A larger file takes longer. Search engines also measure loading speed as part of the page experience. See core web vitals for WordPress owners for the metrics behind it.
Rule 1: use the right size
Do not upload a photo that is wider than it needs to be. A picture shown in a column that is a thousand pixels wide does not need five thousand pixels. Check your theme for the largest width an image is shown, and resize to about that. Resize before you upload, with any image editor.
Rule 2: choose the right format
- JPEG is good for photos.
- PNG is good for logos, screenshots and images that need a clear background.
- WebP is a modern format that is usually smaller than JPEG and PNG, and recent WordPress versions support it. Most current browsers can show it.
- SVG is good for simple logos and icons, since it scales without losing quality.
Rule 3: compress
Compression reduces file size with little visible loss. Many tools can do it before upload, and plugins can do it for you after upload. For photos, a slightly lower quality setting is usually not noticeable. Compare before and after to be sure.
Rule 4: name and describe images
Use a short file name that describes the picture, such as red-shoes.jpg, not IMG_4821.jpg. Add alt text in the media library. Alt text is a short description for people who cannot see the image and for search engines. Write it plainly, and do not stuff keywords.
Rule 5: lazy loading
Lazy loading delays images that are below the first screen until the visitor scrolls. WordPress adds this by default in recent versions. Do not lazy load the main image at the top of the page, since it should appear at once.
Rule 6: set width and height
When an image has no set size, the page jumps while it loads. This is called layout shift and visitors notice it. WordPress usually writes the sizes for you when you insert an image through the editor. Keep it that way.
Fix the images you already have
- Open Media in the admin and sort by size, if your plugin allows it.
- Pick the heaviest images.
- Replace them with resized and compressed versions, or use a plugin that compresses the library.
- Keep a backup first. See website backups guide.
Measure the result
Run a before and after test with the response time checker. Also read speed up a slow WordPress site for other steps. A cache helps too, see caching explained.
Mistakes to avoid
- Uploading images straight from the camera.
- Using a huge image and shrinking it with code.
- Using many different plugins that compress.
- Forgetting alt text.
- Placing text inside images, since search engines cannot read it as text.
FAQ
Will compression make my photos look bad?
A moderate setting is usually fine. Test on your most important images.
How big should an image be?
Smaller is better, as long as it looks sharp. Check the real width where it is shown.
Do I need a plugin?
Not always. If you resize and compress before upload, you may not.