{"id":50,"date":"2026-10-17T13:10:42","date_gmt":"2026-10-17T13:10:42","guid":{"rendered":"https:\/\/refracttools.com\/blog\/?p=50"},"modified":"2026-10-17T13:10:43","modified_gmt":"2026-10-17T13:10:43","slug":"compress-images-for-website","status":"publish","type":"post","link":"https:\/\/refracttools.com\/blog\/image-optimisation\/compress-images-for-website\/","title":{"rendered":"How to compress images for a website without losing quality"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To compress images for a website without visible quality loss, resize them to the size they are actually displayed, then save them as WebP (or AVIF) at around 75\u201385% quality and strip the metadata. For a typical photo straight off a phone or camera, those three steps remove most of the file size while the image looks the same on screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide walks through each step, explains what &#8220;without losing quality&#8221; really means for lossy formats, and covers the settings that suit photos, screenshots and logos.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-refract-takeaways is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\">Key takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Resizing does more than anything else: halve the width and you have a quarter of the pixels.<\/li>\n\n\n<li>Export photos as WebP or AVIF at 75\u201385% quality. Check the result at 100% zoom before you ship it.<\/li>\n\n\n<li>Use PNG or lossless WebP for screenshots and graphics with text, and SVG for logos and icons.<\/li>\n\n\n<li>Strip EXIF metadata. It adds weight and can include the GPS location where a photo was taken.<\/li>\n\n\n<li>Serve smaller versions to smaller screens with <code>srcset<\/code>.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What &#8220;without losing quality&#8221; means<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most web formats, including JPEG, WebP and AVIF, use lossy compression. They throw away detail the eye is unlikely to notice, such as fine colour variation and noise. Some data is always lost. The goal is no <em>visible<\/em> loss at the size the image is shown.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lossless compression, used by PNG and lossless WebP, keeps every pixel exactly but produces much larger files for photos. It is the right choice when exact pixels matter, such as screenshots, diagrams and text, and the wrong one for photographs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: resize to the displayed size<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A photo from a modern phone is often 4000 px wide or more. If the space on your page is 1200 px wide, every extra pixel is downloaded and then thrown away by the browser. File size grows with the number of pixels, which grows with the square of the width: a 2400 px image has four times the pixels of a 1200 px one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Resize to the largest size the image is displayed at, doubled for high-density screens if you want maximum sharpness. A content image shown at 800 px wide, for example, rarely needs to be more than 1600 px.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: choose the right format<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"table-scroll\" tabindex=\"0\" role=\"region\" aria-label=\"Scrollable table\"><table><thead><tr><th>Image type<\/th><th>Best format<\/th><th>Quality setting<\/th><\/tr><\/thead><tbody><tr><td>Photos<\/td><td>WebP, or AVIF for the smallest files<\/td><td>75\u201385%<\/td><\/tr><tr><td>Screenshots, UI, diagrams<\/td><td>PNG or lossless WebP<\/td><td>Lossless<\/td><\/tr><tr><td>Graphics with transparency<\/td><td>WebP (lossy or lossless)<\/td><td>80\u201390% if lossy<\/td><\/tr><tr><td>Logos and icons<\/td><td>SVG<\/td><td>N\/A (vector)<\/td><\/tr><tr><td>Email or other places outside the browser<\/td><td>JPEG<\/td><td>80\u201385%<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Google&#8217;s own figures put lossy WebP at 25\u201334% smaller than an equivalent JPEG. AVIF is usually smaller again for photos but slower to encode. The <a href=\"https:\/\/refracttools.com\/blog\/image-optimisation\/webp-vs-avif-vs-jpeg\/\">WebP vs AVIF vs JPEG guide<\/a> covers the trade-offs in detail. For logos and icons, an optimised SVG is usually a few kilobytes; the <a href=\"https:\/\/refracttools.com\/svg-optimiser\/\">SVG optimiser<\/a> removes editor clutter from exported files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: pick a quality setting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Between 75% and 85% is a good starting range for photos. Above about 90%, files grow quickly for little visible gain. Below about 70%, artefacts start to appear around edges, in skies and on skin.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Quality numbers aren&#8217;t comparable between formats or tools. WebP at 80 is not the same as JPEG at 80, so judge by eye, not by the number.<\/li>\n\n\n<li>Check the result at 100% zoom, looking at fine detail: hair, fabric, foliage and text in the image.<\/li>\n\n\n<li>Large hero images can usually go a little lower, because they are often overlaid with text or slightly soft anyway.<\/li>\n<\/ul>\n\n\n<aside class=\"tool-card tool-card--inline\"><span class=\"swatch\" style=\"background:linear-gradient(135deg,#f59e0b,#7c2d12)\" aria-hidden=\"true\"><\/span><div class=\"tool-card__body\"><p class=\"tool-card__eyebrow\">Free tool<\/p><p class=\"tool-card__name\">Bulk image resizer<\/p><p class=\"tool-card__blurb\">Resize and compress batches of images, privately in your browser.<\/p><\/div><a class=\"btn primary\" href=\"https:\/\/refracttools.com\/bulk-image-resizer\/\">Try it free <span aria-hidden=\"true\">\u2192<\/span><\/a><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: strip the metadata<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Photos carry EXIF data: camera settings, a date, sometimes a thumbnail, and often the GPS coordinates of where the photo was taken. None of it is needed on a web page. Removing it saves a little weight and avoids publishing a location by accident, which matters for photos taken at home or at a client&#8217;s premises.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many CMS and export settings keep EXIF by default. The <a href=\"https:\/\/refracttools.com\/bulk-image-resizer\/\">bulk image resizer<\/a> removes it from every exported file, after using it to rotate photos the right way up.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-refract-callout is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\"><strong>Tip:<\/strong> Many online compressors upload your images to a server to process them. For client work, unreleased products or personal photos, use a tool that runs in your browser instead. Refract&#8217;s image tools never upload your files.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: serve the right size to each screen<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">One resized image is good. Several sizes, letting each device download the one it needs, is better. The <code>srcset<\/code> attribute does this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;img\n  src=\"\/img\/team-1200.webp\"\n  srcset=\"\/img\/team-600.webp 600w,\n          \/img\/team-1200.webp 1200w,\n          \/img\/team-1800.webp 1800w\"\n  sizes=\"(max-width: 700px) 100vw, 700px\"\n  width=\"1200\" height=\"800\"\n  alt=\"The team at the spring workshop\"\n  loading=\"lazy\" decoding=\"async\"&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The browser picks the smallest file that still looks sharp for the screen size and pixel density. Keep <code>width<\/code> and <code>height<\/code> so the page doesn&#8217;t jump while images load, and leave <code>loading=\"lazy\"<\/code> off the main image at the top of the page so it isn&#8217;t delayed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A quick workflow<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Collect the originals in one folder.<\/li>\n\n\n<li>Resize them to the largest display width, or a few widths for <code>srcset<\/code>.<\/li>\n\n\n<li>Export as WebP at 80% quality, with metadata removed.<\/li>\n\n\n<li>Open two or three at 100% zoom and compare them with the originals.<\/li>\n\n\n<li>Adjust the quality up or down by 5 if needed, then export the batch.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You can do all of this in one place with the <a href=\"https:\/\/refracttools.com\/bulk-image-resizer\/\">bulk image resizer<\/a>: drop in a whole folder, set the width, choose WebP or AVIF and a quality level, and download everything as a ZIP. To change format without resizing, use the <a href=\"https:\/\/refracttools.com\/image-converter\/\">image converter<\/a>. Both run entirely in your browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Resize to the displayed size, save as WebP or AVIF at 75\u201385% quality, and strip the metadata. Here is how to compress website images with no visible loss.<\/p>\n","protected":false},"author":1,"featured_media":49,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_refract_tool":"bulk-image-resizer","footnotes":""},"categories":[9],"tags":[31,5,17,14],"class_list":["post-50","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-image-optimisation","tag-image-compression","tag-image-tools","tag-performance","tag-webp"],"_links":{"self":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":1,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions\/69"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media\/49"}],"wp:attachment":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}