{"id":1075,"date":"2021-04-29T12:54:10","date_gmt":"2021-04-29T12:54:10","guid":{"rendered":"http:\/\/shortpixel.com/blog\/?p=1075"},"modified":"2024-11-17T09:37:22","modified_gmt":"2024-11-17T07:37:22","slug":"how-webp-images-can-speed-up-your-site","status":"publish","type":"post","link":"https:\/\/shortpixel.com\/blog\/how-webp-images-can-speed-up-your-site\/","title":{"rendered":"How Can WebP Images Speed Up Your WordPress Site"},"content":{"rendered":"\n<p>You have done an excellent job in optimizing your WordPress website by minifying and compacting your JavaScript and CSS, as well a <a href=\"https:\/\/shortpixel.com\/blog\/properly-size-images-on-wordpress\/\" data-type=\"URL\" data-id=\"https:\/\/shortpixel.com\/blog\/properly-size-images-on-wordpress\/\">serving properly sized images<\/a> and <a href=\"https:\/\/shortpixel.com\/blog\/compress-images-without-losing-quality\/\" data-type=\"URL\" data-id=\"https:\/\/shortpixel.com\/blog\/compress-images-without-losing-quality\/\">optimizing them<\/a> to make them lightweight. <\/p>\n\n\n\n<p>Using plugins such as Autoptimize or ShortPixel Image Optimizer have made this process more manageable. However, there is still more that can be done to improve the performance of your website. <\/p>\n\n\n\n<p>Introducing WebP &#8211; a next-gen image format developed by Google that offers superior compression than traditional formats such as JPG, PNG, and GIF.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Why WebP images instead of other formats?<\/h2>\n\n\n\n<p><a href=\"https:\/\/developers.google.com\/speed\/webp\/docs\/webp_study\" data-type=\"URL\" data-id=\"https:\/\/developers.google.com\/speed\/webp\/docs\/webp_study\" target=\"_blank\" rel=\"noreferrer noopener\">Google&#8217;s study<\/a> indicates that WebP images offer significant size reduction compared to traditional formats. Lossless WebP images are<strong> 26% smaller<\/strong> in size compared to PNGs. Lossy WebP images are <strong>25-34% smalle<span style=\"color: #000000;\">r<\/span><\/strong> than comparable JPEG images at equivalent SSIM quality index.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image alignright size-full\"><a href=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2021\/04\/webp-logo.jpg\"><img decoding=\"async\" width=\"186\" height=\"66\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2021\/04\/webp-logo.jpg\" alt=\"webp images logo\" class=\"wp-image-6560\" title=\"\"><\/a><\/figure>\n\n\n\n<p>Lossless WebP <strong>supports transparency<\/strong> (also known as alpha channel) at a cost of just <strong>22% additional bytes<\/strong>. For cases when lossy RGB compression is acceptable, <strong>lossy WebP also supports transparency<\/strong>, typically providing 3 times smaller file sizes compared to PNG.<\/p>\n\n\n\n<p>That&#8217;s a huge improvement. The reduced file size WebP images offer without having to reduce image quality leads to <strong>a faster page speed<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which browser supports WebP images?<\/h2>\n\n\n\n<p>In order for WebP images to be displayed, the web browser used by the visitor must have the capability to support the format. Although browser support for WebP has increased recently, it is not yet a universally accepted format among all browsers.<\/p>\n\n\n\n<p>At the time of writing, WebP images are supported by popular browsers such as Chrome, Firefox, Edge, Safari (full support for macOS 11 Big Sur and later), Safari for iOS, Android Browser, Opera, and so on.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1630\" height=\"573\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers.png\" alt=\"\" class=\"wp-image-7327\" title=\"\" srcset=\"https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers.png 1630w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers-300x105.png 300w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers-1024x360.png 1024w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers-768x270.png 768w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/webp-compatible-browsers-1536x540.png 1536w\" sizes=\"(max-width: 1630px) 100vw, 1630px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/caniuse.com\/#feat=webp\" target=\"_blank\" rel=\"noreferrer noopener\">More than 94% of users<\/a> operate a web browser that supports WebP images.<\/p>\n\n\n\n<p>In the tutorial that follows, we will demonstrate a simple method for creating and delivering WebP images on WordPress, which can enhance the speed of your website and improve the user experience.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to create WebP images in WordPress?<\/h2>\n\n\n\n<p>If you have a WordPress website, you are lucky, because there is a simple solution to create WebP images.<\/p>\n\n\n\n<p>Using <a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-image-optimiser\/\" target=\"_blank\" rel=\"noopener noreferrer\">ShortPixel Image Optimizer<\/a>, you can<strong> create WebP images <\/strong>alongside the existing formats when optimizing your images. After installing the plugin, navigate to <strong>Settings <\/strong>&gt; <strong>ShortPixel <\/strong>&gt; <strong>Advanced <\/strong>and enable the option.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"1539\" height=\"424\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio.png\" alt=\"\" class=\"wp-image-7328\" title=\"\" srcset=\"https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio.png 1539w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio-300x83.png 300w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio-1024x282.png 1024w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio-768x212.png 768w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2021\/04\/create-webp-spio-1536x423.png 1536w\" sizes=\"(max-width: 1539px) 100vw, 1539px\" \/><\/figure>\n\n\n\n<p>WebP versions of images are only generated during the optimization process. To create WebP images after the images have been optimized with the plugin, the simplest solution would be to run the bulk optimization by navigating to Media &gt; Bulk ShortPixel, and turning on the toggle to create WebP before following the process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How can I serve WebP images on WordPress?<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using bult-in solutions of a plugin<\/strong><\/h3>\n\n\n\n<p>You are able to serve WebP versions of the images on your WordPress website using a plugin such as ShortPixel Image Optimizer, which comes with two delivery methods:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Without altering the page code (via .htaccess)<\/strong><\/h4>\n\n\n\n<p>This delivery method will add a new code block to the .htaccess file, which will ensure that the browser supports WebP images. If both the JPG\/PNG\/GIF and WebP versions of an image are available, the server will deliver the WebP version. This approach has the advantage of serving WebP image files directly without making any changes to the page code.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Altering the page code<\/strong><\/h4>\n\n\n\n<p>Now you can use the WebP image format by simply checking the corresponding &#8220;<em>Using the &lt;PICTURE&gt; tag synta<\/em>x&#8221; option in the advanced settings tab of ShortPixel and all your &lt;img&gt; tags will be replaced with &lt;picture&gt; tags that include the WebP images, letting the browser chose the best version according to its capabilities. <\/p>\n\n\n\n<p>The &lt;picture&gt; tag contains also a Generate WebP markup tag for fallback reasons, allowing the styles to remain in place. In some rare cases &#8211; when the styling of your images relies on positional queries ( :first, :nth-child selectors or &#8220;&gt;&#8221; direct child reference ) you might encounter styling problems when activating this option and you will need to use the cache plugin solution below. <\/p>\n\n\n\n<p>The second option can be implemented either by hooking onto WordPress&#8217;s own functions (a more limited, but a bit safer method) or by simply analyzing all the code in a page and doing the required changes before serving the page to the browser (this ensures more independence from any third-party tools that might not operate through the official WordPress channels and methods).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Cache plugin solution<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Using <a href=\"https:\/\/wordpress.org\/plugins\/cache-enabler\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/wordpress.org\/plugins\/cache-enabler\/\" rel=\"noreferrer noopener\">Cache Enabler<\/a><\/h4>\n\n\n\n<p>You can also use a cache plugin that is WebP aware. We&#8217;ve tested the Cache Enabler plugin and it works out of the box with ShortPixel in delivering the WebP images. You just need to install and activate it, then go to <strong>Settings &gt; Cache Enabler<\/strong> and check the option to <strong>&#8220;Create an additional cached version for WebP image support&#8221;<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/cache-enabler-webp.png\"><img decoding=\"async\" width=\"637\" height=\"164\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/cache-enabler-webp.png\" alt=\"\" class=\"wp-image-1088\" title=\"\" srcset=\"https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/cache-enabler-webp.png 637w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/cache-enabler-webp-300x77.png 300w\" sizes=\"(max-width: 637px) 100vw, 637px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Using <strong><a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\" data-type=\"URL\" data-id=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\" target=\"_blank\" rel=\"noreferrer noopener\">LiteSpeed Cache<\/a><\/strong><\/h4>\n\n\n\n<p>You can also use LiteSpeed Cache plugin to serve WebP. After creating your WebP files, you can serve them by following the instructions below.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add this constant in wp-config.php:<\/li>\n<\/ol>\n\n\n\n<blockquote><pre>define('SHORTPIXEL_USE_DOUBLE_WEBP_EXTENSION', true);<\/pre><\/blockquote>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>Activate the LiteSpeed&#8217;s Advanced settings:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-18-58.png\"><img decoding=\"async\" width=\"710\" height=\"109\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-18-58.png\" alt=\"\" class=\"wp-image-4749\" title=\"\" srcset=\"https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-18-58.png 710w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-18-58-300x46.png 300w\" sizes=\"(max-width: 710px) 100vw, 710px\" \/><\/a><\/figure>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Activate the WebP delivery options:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-20-08.png\"><img decoding=\"async\" width=\"862\" height=\"565\" src=\"https:\/\/shortpixel.com/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-20-08.png\" alt=\"\" class=\"wp-image-4748\" title=\"\" srcset=\"https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-20-08.png 862w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-20-08-300x197.png 300w, https:\/\/shortpixel.com\/blog\/wp-content\/uploads\/2016\/11\/Screenshot-from-2019-08-29-18-20-08-768x503.png 768w\" sizes=\"(max-width: 862px) 100vw, 862px\" \/><\/a><\/figure>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Do not activate LiteSpeed&#8217;s option to generate the WebP images files &#8211; ShortPixel Image Optimizer will generate them when optimizing the images (if you already have optimized images and didn&#8217;t generate WebP, you will need to run the bulk optimization again by navigating to Media > Bulk ShortPixel.).<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Using WP Rocket<\/h4>\n\n\n\n<p>If you are using WP Rocket, you can simply create WebP files using ShortPixel Image Optimizer, as previously explained, and deliver them to compatible browsers using WP Rocket.<\/p>\n\n\n\n<p>In order to achieve that, navigate to WP Rocket plugin settings &gt; Add-ons, and turn on the <a href=\"https:\/\/docs.wp-rocket.me\/article\/1282-webp\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/docs.wp-rocket.me\/article\/1282-webp\" rel=\"noreferrer noopener\">WebP Compatibility<\/a> feature.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Now that you know what WebP images are and how can they speed up the performance of your website, why don&#8217;t you give <a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-image-optimiser\/\" data-type=\"URL\" data-id=\"https:\/\/wordpress.org\/plugins\/shortpixel-image-optimiser\/\" target=\"_blank\" rel=\"noreferrer noopener\">ShortPixel Image Optimizer<\/a> a try and start creating and serving them? <\/p>\n\n\n\n<p>You can sign up for a <a href=\"https:\/\/shortpixel.com\/free-sign-up\" data-type=\"URL\" data-id=\"https:\/\/shortpixel.com\/free-sign-up\" target=\"_blank\" rel=\"noreferrer noopener\">free account here<\/a> that includes 100 credits per month, which you can spend on compressing your images, as well as generating WebP.<\/p>\n\n\n\n<p>We&#8217;d love to hear your thoughts! Drop us a line below and let us know if you have any questions or recommendations about WebP images.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have done an excellent job in optimizing your WordPress website by minifying and compacting your JavaScript and CSS, as well a serving properly sized images and optimizing them to make them lightweight. Using plugins such as Autoptimize or ShortPixel Image Optimizer have made this process more manageable. However, there is still more that can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6562,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1075","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-world-of-wordpress"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/posts\/1075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/comments?post=1075"}],"version-history":[{"count":32,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/posts\/1075\/revisions"}],"predecessor-version":[{"id":11786,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/posts\/1075\/revisions\/11786"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/media\/6562"}],"wp:attachment":[{"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/media?parent=1075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/categories?post=1075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shortpixel.com\/blog\/wp-json\/wp\/v2\/tags?post=1075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}