Images Optimization
WordPress Speed Optimization: Images
Intermediate — comfortable working with WordPress.
Advanced — developer or server-administrator skills recommended.
Medium — noticeable improvement.
High — potentially significant page-load improvement.
- Choose the Proper Image Format
- Choose Proper Image Dimensions
- Set Proper Media Sizes
- Use Responsive Images
- Compress Images
- Convert Unnecessary Transparent PNGs
- Use CSS for Simple Graphics
- Choose SVG or Icon Fonts Carefully
- Remove Unused Media Sizes
- Use CSS Sprites Only When Appropriate
- Compress Video Content
- What’s next?
1. Choose the Proper Image Format
Different image formats are better suited to different types of content.
2. Choose Proper Image Dimensions
Do not upload an image that is much larger than the area where it will actually be displayed.
- For a 400 px-wide display area, use an image close to 400 px wide when high-density support is not important.
- For important images on high-density displays, an image around twice the display width can provide additional sharpness.
- Less important thumbnails and small graphics usually do not require oversized retina versions.
- Crop, resize, and optimize camera photos before uploading them to WordPress.
3. Set Proper Media Sizes in Themes and Plugins
WordPress themes and plugins can generate multiple image sizes. These sizes should closely match the actual layout dimensions used throughout the website.
- Finalize the website layout before deciding the required media sizes.
- Review Settings > Media in WordPress.
- For WooCommerce, review product-image dimensions under the theme customizer or WooCommerce image settings.
- Check theme and plugin settings for additional generated sizes.
- After changing image dimensions, regenerate thumbnails so older uploads receive the new sizes.
4. Use Responsive Images for Smaller Devices
Mobile devices should receive appropriately sized images instead of downloading desktop-size files unnecessarily.
- Use a responsive WordPress theme that supports adaptive image markup.
- Verify that the theme uses WordPress responsive-image capabilities correctly.
- Pay special attention to large background images, which are sometimes not handled responsively.
- Avoid configurations that download both desktop and mobile image versions for the same visitor.
5. Compress Images
Compression reduces file size while maintaining acceptable visual quality.
- Manual JPEG compression — use an image editor to select the lowest quality setting that still looks acceptable.
- Manual PNG optimization — reduce unnecessary colors and metadata when possible.
- Automatic compression — use a WordPress image-optimization plugin when manual processing is impractical.
- Use stronger manual control for important hero images and automated compression for routine content if required.
6. Convert Unnecessary Transparent PNGs to JPEG
Transparent PNG files can be much larger than JPEGs. If transparency is not genuinely needed, changing the format can reduce file size considerably.
- If a transparent image always appears on a solid background, flatten the background into the image.
- Photographic content can often be converted to JPEG after the background is added.
- For simple graphics, compare optimized PNG and JPEG output and use the smaller suitable file.
7. Redraw Simple Images or Icons with CSS
Simple visual elements do not always require an image file. CSS can create many common interface decorations directly in the browser.
- Lines and blocks.
- Simple menu or navigation shapes.
- Gradients.
- Shadows.
- Black-and-white or color-filter effects.
Replacing unnecessary image assets can reduce HTTP requests and make visual styles easier to adapt responsively.
8. Choose SVG or Icon Fonts Carefully
For scalable interface icons, SVG and custom icon fonts are generally more efficient than loading many separate raster images.
- Very simple icons may be drawn directly with CSS.
- For only a few complex icons, optimized SVG files can be efficient.
- For a larger consistent icon set, a small custom icon font may be suitable.
- Avoid loading a large third-party icon library when only a few icons are actually used.
- Optimize SVG files by removing unnecessary metadata and complexity.
- Inline SVG only when the file is very small and the usage justifies embedding it in the page markup.
9. Remove Unused Media Sizes
Every additional WordPress image size can create another physical file for every uploaded image. Excessive media sizes increase storage usage and can make backups and media maintenance heavier.
- Disable media sizes that are never used by the active design.
- Remove sizes that are extremely similar when one larger size can serve both layouts acceptably.
- Check theme and plugin settings before modifying code-level media registrations.
- After disabling unused sizes, remove obsolete generated files carefully and only after confirming they are not referenced by the website.
10. Use CSS Sprites Only When Appropriate
CSS sprites combine several small images into one file and display only the required area through CSS. This technique was originally used to reduce HTTP requests.
Modern HTTP/2 and HTTP/3 reduce the importance of minimizing every individual request, while CSS, SVG, and icon fonts can replace many small graphical assets. Sprites can still be useful for a group of small multicolor graphics that cannot be represented efficiently in another way.
11. Compress Video Content
Video assets can be substantially larger than images, especially when they autoplay as page backgrounds or hero media.
- Compress videos before using them on the website.
- Use web-friendly formats such as MP4 or WebM.
- Remove audio when the video does not require sound.
- Reduce resolution and bitrate when the video is only decorative background content.
- Do not make a background video physically larger than the layout requires.
- Consider whether a static image can achieve the same design goal with much lower bandwidth.
