Title: Images to WebP
Author: kubiq
Published: <strong>November 17, 2019</strong>
Last modified: March 16, 2026

---

Search plugins

![](https://ps.w.org/images-to-webp/assets/banner-772x250.png?rev=2195047)

![](https://ps.w.org/images-to-webp/assets/icon-256x256.png?rev=2195047)

# Images to WebP

 By [kubiq](https://profiles.wordpress.org/kubiq/)

[Download](https://downloads.wordpress.org/plugin/images-to-webp.5.0.zip)

 * [Details](https://wordpress.org/plugins/images-to-webp/#description)
 * [Reviews](https://wordpress.org/plugins/images-to-webp/#reviews)
 *  [Installation](https://wordpress.org/plugins/images-to-webp/#installation)
 * [Development](https://wordpress.org/plugins/images-to-webp/#developers)

 [Support](https://wordpress.org/support/plugin/images-to-webp/)

## Description

Statistics say that WebP format can save over a half of the page weight without 
losing images quality.
 Convert PNG, JPG and GIF images to WebP and speed up your
web, save visitors download data, make your Google ranking better.

 * **automated test after plugin activation to make sure it will work on your server**
 * **works with all types of WordPress installations: domain, subdomain, subdirectory,
   multisite/network**
 * **works on Apache and NGiNX**
 * **image URL will be not changed** so it works everywhere, in <img> src, srcset,
   <picture>, even in CSS backgrounds and there is no problem with cache
 * **original files will be not touched**
 * set quality of converted images
 * auto convert on upload
 * only convert image if WebP filesize is lower than original image filesize
 * bulk convert existing images to WebP ( you can choose folders )
 * bulk convert only missing images
 * works with `Fly Dynamic Image Resizer` plugin

### Hooks for developers

#### itw_sizes

Maybe you want to disable WebP for thumbnails

    ```
    add_filter( 'itw_sizes', 'disable_itw_sizes', 10, 2 );
    function disable_itw_sizes( $sizes, $attachmentId ){
        unset( $sizes['thumbnail'] );
        return $sizes;
    }
    ```

#### itw_htaccess

Maybe you want to modify htaccess rules somehow

    ```
    add_filter( 'itw_htaccess', 'modify_itw_htaccess', 10, 2 );
    function modify_itw_htaccess( $rewrite_rules ){
        // do some magic here
        return $rewrite_rules;
    }
    ```

#### itw_abspath

Maybe you use roots.io/bedrock or other custom folder structure

    ```
    add_filter( 'itw_abspath', 'modify_itw_abspath', 10, 2 );
    function modify_itw_abspath( $abspath ){
        return trailingslashit( WP_CONTENT_DIR );
    }
    ```

#### $images_to_webp->convert_image()

Maybe you want to automatically generate WebP for other plugins

    ```
    add_action( 'XXPLUGIN_image_created', 'XX_images_to_webp', 10, 2 );
    function XX_images_to_webp( $image_path ){
        global $images_to_webp;
        $images_to_webp->convert_image( $image_path );
    }
    ```

## Screenshots

[[

[[

[[

## Installation

 1. Upload `images-to-webp` directory to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

## FAQ

### Plugin requirements

It should work almost everywhere 😉
 PHP 5.6 or higher GD or Imagick extension with
WebP support Enabled server modules: `mod_mime`, `mod_rewrite`

### WebP images stored location

WebP images are generated in same directory as original image. Example:
 original
img: `/wp-content/uploads/2019/11/car.png` webp version: `/wp-content/uploads/2019/
11/car.png.webp`

### How to get original image from the browser?

Just add `?no_webp=1` to the URL and original JPG/PNG will be loaded

### How to check if plugin works?

When you have installed plugin and converted all images, follow these steps:

 1. Run `Google Chrome` and enable `Dev Tools` (F12).
 2. Go to the `Network` tab click on `Disable cache` and select filtering for `Img`_(
    Images)_.
 3. Refresh your website page.
 4. Check list of loaded images. Note `Type` column.
 5. If value of `webp` is there, then everything works fine.

### NGiNX and Apache together

If you have some proxy setup or some other combination of NGiNX and Apache on your
server, then probably .htaccess changes won’t work and you will need to ask your
hosting provider to disable NGiNX direct processing of image static files.

### Apache .htaccess

Plugin should automatically update your .htaccess with needed rules.
 In case it’s
not possible to write them automatically, screen with instructions will appear. 
Anyway, here is how it should look like:

    ```
    <IfModule mod_mime.c>
        AddType image/webp .webp
    </IfModule>

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTP_ACCEPT} image/webp
        RewriteCond %{REQUEST_FILENAME} "/"
        RewriteCond %{REQUEST_FILENAME} "\.(jpg|jpeg|png|gif)$"
        RewriteCond %{REQUEST_FILENAME}\.webp -f
        RewriteCond %{QUERY_STRING} !no_webp
        RewriteRule ^(.+)$ $1\.webp [NC,T=image/webp,E=webp,L]
    </IfModule>
    ```

### NGiNX config

After you activate plugin, screen with instructions will appear.
 Anyway, here is
how it should look like:

You need to add this map directive to your http config, usually nginx.conf ( inside
of the http{} section ):

    ```
    map $arg_no_webp $no_webp{
        default "";
        "1" "no_webp";
    }

    map $http_accept $webp_suffix{
        default "";
        "~*webp" ".webp";
    }
    ```

or without `map` directive:

    ```
    if ( $http_accept ~ "image/webp" ) {
        set $webp .webp ;
    }

    location ~* (.*)\.(?:png|jpe?g|gif)$ {
        if ( -f $document_root$1.webp ) {
                set $webp serve$webp ;
        }
        if ( $webp = "serve.webp" ) {
            return 301 '$1.webp';
        }
    }
    ```

then you need to add this to your server block, usually site.conf or /nginx/sites-
enabled/default ( inside of the server{} section ):

    ```
    location ~* ^/.+\.(png|gif|jpe?g)$ {
        add_header Vary Accept;
        try_files $uri$webp_suffix$no_webp $uri =404;
    }
    ```

### ISP Manager

Are you using ISP Manager? Then it’s probably not working for you, but no worries,
you just need to go to `WWW domains` and delete `jpg|jpeg|png` from the `Static 
content extensions` field.

### Delete all generated WebP images

There is no button to do that and it will also not delete generated WebPs automatically
when you deactivate the plugin, but if you really need this, you can run some shell
command to achieve this:

    ```
    find . -type f -name "*.webp" -exec bash -c 'if [ -f "${1%.webp}" ]; then echo "Deleting $1"; rm "$1"; fi' _ {} \;
    ```

This will find all the files with a `.webp` extension and if there is similar file
with the exact filename, but without the `.webp` extension, then it will delete 
it.

## Reviews

![](https://secure.gravatar.com/avatar/4ba6bbf944526d1af3705872b94eabb450790a82eaa5b99ae3d738135cf1f6d6?
s=60&d=retro&r=g)

### 󠀁[It works flawlessly.](https://wordpress.org/support/topic/it-works-flawlessly-11/)󠁿

 [](https://profiles.wordpress.org/sinchro/) June 25, 2026

For Nginx, I had to make a change to the .conf file, and then everything worked 
perfectly. The only caveat is that the instructions state you need to make changes
to the http{} section, but that section isn’t present in all configuration files.
For example, in Docker, configurations are included via http {include /etc/nginx/
conf.d/*.conf;}, meaning that the entire configuration file is already contained
within the http section in the main configuration file, and you won’t see it as 
a separate section.

![](https://secure.gravatar.com/avatar/6311071caa95ff0707e5b985854a9ccd128a292ed81249c351d68591941abbc9?
s=60&d=retro&r=g)

### 󠀁[A Brilliant Piece of Work](https://wordpress.org/support/topic/a-brilliant-piece-of-work/)󠁿

 [philrees](https://profiles.wordpress.org/philrees/) September 27, 2024

I am highly impressed by this well thought out and elegant module. It works perfectly
for me

![](https://secure.gravatar.com/avatar/912cc226a057238880ee9a0c87fa938b7a0f991b27ef849e2ca1c1cf0beca4d6?
s=60&d=retro&r=g)

### 󠀁[Working great!](https://wordpress.org/support/topic/working-great-348/)󠁿

 [Shuaib](https://profiles.wordpress.org/shuaiburrahman/) August 18, 2024

Working great! It was challenging for me to optimize the existing images, but it
makes it simple.

![](https://secure.gravatar.com/avatar/d751e77fecfc8db708e0ff2b1c82fd98cf70fa3a06c350db046ff459c03998fb?
s=60&d=retro&r=g)

### 󠀁[Fantastic plugin and easy to get working with cropping plugins](https://wordpress.org/support/topic/fantastic-plugin-and-easy-to-get-working-with-cropping-plugins/)󠁿

 [pulsecode](https://profiles.wordpress.org/pulsecode/) July 3, 2024

This plugin is a bit of a game changer for me!Having extensively used custom images
sizes and the Crop-Thumbnails plugin for many clients to allow them much better 
control of their images, i ran into a big problem when it came to serving images
as WebP.Images were cropped automatically upon upload (and of course converted to
WebP) but when adjusting the crop position later on, the WebP converted images were
never updated, effectively breaking the cropping function.But this plugin is not
only fast, efficient and free (amazing work guys!) but has a completely life saving
function: $images_to_webp->convert_image()Using this i was easily able to connect
Crop-Thumbnails up and have it so whenever a user adjusts a crop, that image is 
re-converted to WebP.Thank you for such a fantastic plugin!

![](https://secure.gravatar.com/avatar/cca6e93c4dcaa09671ccfe0102cb700b26fbcd2540ccd689ac877c4ddf8ff5b6?
s=60&d=retro&r=g)

### 󠀁[Отличный плагин!](https://wordpress.org/support/topic/%d0%be%d1%82%d0%bb%d0%b8%d1%87%d0%bd%d1%8b%d0%b9-%d0%bf%d0%bb%d0%b0%d0%b3%d0%b8%d0%bd-952/)󠁿

 [Evgeni](https://profiles.wordpress.org/karsky/) June 11, 2024

Хорошая работа. Спасибо)

![](https://secure.gravatar.com/avatar/d56015752c48630102f3d7514b204fc94b698b4e853326b629c83af2de5cf5b9?
s=60&d=retro&r=g)

### 󠀁[Simple and effective conversion](https://wordpress.org/support/topic/simple-and-effective-conversion/)󠁿

 [oasisclub](https://profiles.wordpress.org/oasisclub/) April 10, 2024

Simple to use, clear instructions – very effective. Eenvoudig om te gebruik, duidelike
instruksies, baie effektief.

 [ Read all 32 reviews ](https://wordpress.org/support/plugin/images-to-webp/reviews/)

## Contributors & Developers

“Images to WebP” is open source software. The following people have contributed 
to this plugin.

Contributors

 *   [ kubiq ](https://profiles.wordpress.org/kubiq/)

“Images to WebP” has been translated into 6 locales. Thank you to [the translators](https://translate.wordpress.org/projects/wp-plugins/images-to-webp/contributors)
for their contributions.

[Translate “Images to WebP” into your language.](https://translate.wordpress.org/projects/wp-plugins/images-to-webp)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/images-to-webp/), check
out the [SVN repository](https://plugins.svn.wordpress.org/images-to-webp/), or 
subscribe to the [development log](https://plugins.trac.wordpress.org/log/images-to-webp/)
by [RSS](https://plugins.trac.wordpress.org/log/images-to-webp/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 5.0

 * now images are optimized in the background instead of during upload which was
   slowing down the workflow
 * fix many small things based on the current Plugin Check results

#### 4.9.1

 * optimize old images convert process
 * remove not working itw_extensions filter

#### 4.9

 * info banner about new free Images to AVIF plugin
 * prioritize GD library
 * readme small changes

#### 4.8

 * Tested on WP 6.9

#### 4.7

 * Tested on WP 6.5

#### 4.6

 * Fix for “Find and convert MISSING images” button

#### 4.5

 * Tested on WP 6.4
 * added FAQ section “Delete all generated WebP images”

#### 4.4

 * Tested on WP 6.3
 * added FAQ section “NGiNX and Apache together”
 * make configs error messages more descriptive

#### 4.3

 * Tested on WP 6.2
 * new filter itw_abspath for WP installations with customized folder structure 
   like Bedrock

#### 4.2

 * make convert old works also for local installations

#### 4.1

 * fix – convert also all subdirectories

#### 4.0

 * lazy load folders in convert tab
 * make it works for local installations like XAMPP or Flywheel Local
 * try-catch conversion errors
 * updated jstree library

#### 3.1

 * add ?no_webp=1 to URL to receive original image content from Nginx server

#### 3.0

 * Tested on WP 6.1
 * added support for Better image sizes plugin
 * add ?no_webp=1 to URL to receive original image content – works only on Apache
   and only with direct image URL

#### 2.0

 * Tested on WP 6.0
 * convert and serve WebP images anywhere – not only in wp-content folder
 * option to delete original images after conversion

#### 1.9.1

 * Tested on WP 5.9

#### 1.9

 * Tested on WP 5.8
 * added some nonce checks and more security validations
 * better nginx instructions

#### 1.8

 * Tested on WP 5.7
 * add more CURL options
 * fix backslashes for localhosts

#### 1.7

 * Tested on WP 5.6
 * fixed problem on some multisites

#### 1.6

 * Tested on WP 5.4
 * added support for Fly Dynamic Image Resizer plugin

#### 1.5

 * notice when test image is not accessible

#### 1.4

 * new test method

#### 1.3

 * fixed text domain for translations

#### 1.2

 * added instructions for NGiNX

#### 1.1

 * make it works in multisite and subdirectory installs

#### 1.0

 * First version

## Meta

 *  Version **5.0**
 *  Last updated **4 months ago**
 *  Active installations **9,000+**
 *  WordPress version ** 5.0 or higher **
 *  Tested up to **6.9.4**
 *  PHP version ** 7.0 or higher **
 *  Languages
 * [Chinese (China)](https://cn.wordpress.org/plugins/images-to-webp/), [Czech](https://cs.wordpress.org/plugins/images-to-webp/),
   [Danish](https://da.wordpress.org/plugins/images-to-webp/), [Dutch](https://nl.wordpress.org/plugins/images-to-webp/),
   [English (US)](https://wordpress.org/plugins/images-to-webp/), [Russian](https://ru.wordpress.org/plugins/images-to-webp/),
   and [Swedish](https://sv.wordpress.org/plugins/images-to-webp/).
 *  [Translate into your language](https://translate.wordpress.org/projects/wp-plugins/images-to-webp)
 * Tags
 * [convert](https://wordpress.org/plugins/tags/convert/)[media](https://wordpress.org/plugins/tags/media/)
   [Optimize](https://wordpress.org/plugins/tags/optimize/)[pictures](https://wordpress.org/plugins/tags/pictures/)
 *  [Advanced View](https://wordpress.org/plugins/images-to-webp/advanced/)

## Ratings

 4.4 out of 5 stars.

 *  [  27 5-star reviews     ](https://wordpress.org/support/plugin/images-to-webp/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/images-to-webp/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/images-to-webp/reviews/?filter=3)
 *  [  1 2-star review     ](https://wordpress.org/support/plugin/images-to-webp/reviews/?filter=2)
 *  [  4 1-star reviews     ](https://wordpress.org/support/plugin/images-to-webp/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/images-to-webp/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/images-to-webp/reviews/)

## Contributors

 *   [ kubiq ](https://profiles.wordpress.org/kubiq/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/images-to-webp/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://www.paypal.me/jakubnovaksl)