How to Optimize WordPress Images Automatically on Upload

Disclosure: This post may contain affiliate links. Purchasing a product through one of these links generates a commission for us at no additional expense to you.

Optimizing your images is one of the best ways to speed up your site.

On the average site, images take 50% of the page’s total weight! If you have a media-rich website with portfolio layouts and galleries, it’s probably even higher.

These stats reveal how image compression can have a massive impact on your load times.

How to compress the images

There are lots of free tools available to optimize your images before you upload them to your site. However, it’s best to use a plugin to compress your images. 

There are two reasons why.

First of all, using a separate tool to optimize your images is a pain. With an image optimization plugin installed on your site, you can automatically compress them as you upload them to your site.

Secondly, what about the images you already uploaded to your site? You would need to download them all, optimize them, and then re-upload. Trust me, this process would be a nightmare.

Which plugin to use?

There are a number of plugins available for image compression, but I use ShortPixel here at Compete Themes and recommend it for other WordPress users too.


With a few easy steps, you can reduce the size of your images by up to 80% on average. Considering images may make up half of your load time, that’s a massive improvement.

How to automatically optimize images on upload

Once you install and activate the ShortPixel plugin, you’ll see a screen where you can enter an API key.

Shortpixel Start Menu

Enter your email address and click the Request Key button and an API key will be sent to your email. And don’t worry, the ShortPixel team handles email addresses responsibly and won’t spam you when they get your address.

Once you enter your key, you’ll be taken to the settings menu where you can configure the image optimization settings.

Shortpixel Menu

In my opinion, the default settings are great, and you likely won’t need to adjust anything. In the Advanced tab, you’ll find the option to enable automatic image compression upon upload, and this setting is already turned on by default.

Another great feature of ShortPixel is that you can compress all images already uploaded to your site which can immediately speed up your site.

Alternatives to ShortPixel

The best alternatives to ShortPixel are WP Smush and Imagify.

WP Smush is free and has a premium upgrade that adds some additional features such as PNG to JPG conversion. Imagify provides a limited number of image optimizations each month for free and charges a small fee to compress more.


Compressing images on your WordPress site automatically when you upload them is actually pretty easy. There are a few good choices available, but ShortPixel stands out as the best.

We have a more detailed tutorial on using ShortPixel you can follow along with if you want additional instruction. Give that post a look if you want to see what else this plugin can do.

Ben Sibley
Ben Sibley
This article was written by Ben Sibley. He is a WordPress theme designer & developer, and founder of Compete Themes.