Talk to a person. We reply within one working day.

SEO and AI search
Web
AI
Resources
WorkAboutStart a project

Websites · 29 Oct 2026 · 10 min read

How to Compress Images for Website: Size and Format

How to compress images for a website: what size to export, which format to choose and how to keep quality, with a simple workflow to follow.

By the Liftup team in Pune

How to Compress Images for Website: Size and Format

350+businesses served

8countries

7+years

  • Ajyal Al Mustakbal Education
  • APHERO
  • Bimble
  • D'Decor
  • Edunova
  • Emoticons India
  • Gatha
  • Improp
  • Interakt
  • Jai Ganesh Industries
  • Medicine Free Life
  • Premium Learnings
  • Serene Eco Village
  • Tata Tele Business Services
  • WTS Management

Why image size matters

Images are often the heaviest part of a page. This guide explains what size to export, which file format suits each kind of picture and how to compress without visible loss.

To compress images for a website, export each one no bigger than the space it fills, with extra width for sharp screens. Use JPEG, WebP or AVIF for photographs, PNG or WebP for flat graphics and screenshots, and SVG for logos and icons. Then lower the quality setting until the loss just shows and step back one notch. Check the result on a phone.

To compress images for a website, start by deciding how big each one needs to be. Images are often the heaviest files on a page. Oversized ones slow the page down, use up visitors' mobile data and can delay the moment the main content appears. Compressing them is among the cheapest speed fixes a site has, and it needs no change to the design.

Compression does not mean ugly pictures. The aim is the smallest file that still looks right at the size it is shown. The sections below take it in order: size first, then format, then compression, then how the page loads the files.

Rather have it done for you? See our SEO service, from $1,500.

On this page 9 sections
  1. Why image size matters
  2. What size should website images be?
  3. Which image format should I use?
  4. How do I compress images for a website without losing quality?
  5. Tools and automation
  6. How the page should load images
  7. Common image mistakes
  8. Who does what in a website project
  9. Questions and answers

What size should website images be?

Make each image as large as the space it fills on the page, and no larger, then allow extra for sharp screens. Two kinds of size matter and they are different things. Dimensions are the width and height in pixels. File size is the weight of the file. Reducing the dimensions is the first and biggest saving, because the file has to store every pixel.

Find the display size by asking your designer or developer for the widest space each kind of image fills: a full-width banner, a card in a grid, a product picture, a team portrait or an article illustration. That gives you a handful of sizes, not hundreds. Prepare your pictures for those slots.

High-density screens complicate this. Many phones and laptops draw one layout pixel with several device pixels, so an image exported at exactly the slot width can look soft. web.dev's guidance on high-density images explains the trade-off, and a heavily compressed larger image can look better than an uncompressed smaller one at a similar file weight. The usual answer is to offer the larger version to screens that can use it and a smaller one to the rest. Responsive image markup does this, as a later section explains.

Crop to the shape the layout needs before you upload. A wide banner cut from a tall portrait wastes pixels. Keep the shapes consistent across a set, for example every product picture in the same ratio, so the layout does not jump.

Do not enlarge small pictures. Scaling up adds weight but no detail. Keep a full-size original somewhere safe and export web copies from it, so that you can make new sizes later without compressing a compressed file again.

Free · no obligation

Get a free SEO and AI visibility check of your site

We look at how Google and AI tools like ChatGPT see your site and send you the top fixes, within one working day.

Which image format should I use?

Choose the format by the kind of picture. MDN's guide to image file types and web.dev's guidance agree on the basics, which the table sums up.

Kind of pictureGood choicesWhyAvoid
Photographs and smooth gradientsJPEG, lossy WebP or AVIFLossy formats make small files and suit continuous tonesPNG, which is heavier for photographs
Logos, icons and simple drawingsSVGIt is drawn from shapes, so it stays sharp at any sizeRaster files for logos
Screenshots, charts and text in an imagePNG or lossless WebPEdges stay sharp without compression artefactsJPEG, which blurs around text and edges
Pictures with see-through areasPNG, WebP or AVIF, or SVG for graphicsThey support transparencyJPEG, which has none

JPEG is the dependable default for photographs. WebP and AVIF are newer and often compress better. web.dev notes that AVIF can give the best quality for a given size on photographs but has been less widely supported, so it is used with a fallback, usually through the picture element, so that browsers which cannot read it receive a JPEG. WebP is a safer middle step. Check browser support in the current MDN documentation before you rely on any new format.

Google Search lists BMP, GIF, JPEG, PNG, WebP, SVG and AVIF as image formats it supports, and asks for the file extension to match the file type. The choice is therefore about speed and quality, not about whether Google can read the picture.

How do I compress images for a website without losing quality?

There are two kinds of compression. Lossless compression makes a file smaller without discarding picture data, so the image is identical when opened. Lossy compression discards detail that the eye is least likely to miss, which makes smaller files but can leave visible artefacts if pushed too far. Photographs usually suit lossy compression. Flat graphics and screenshots often suit lossless.

For a lossy image, the method is to find the lowest quality setting that still looks right. Most editing and compression tools offer a quality slider or a similar setting. Export a version, view it at the size it will appear on a phone as well as on a computer, and look at the hard cases: faces, skies, edges and text. Lower the setting until you can just see damage, then go back one notch. Settings differ between tools and formats, so do not copy a number from another site. Compare by eye.

A workflow that works for most sites:

  1. Keep the original and never overwrite it.
  2. Crop to the shape the layout needs.
  3. Resize to the slot width, and export a larger copy for sharp screens if the layout supports it.
  4. Pick the format for the kind of picture.
  5. Export with a quality setting you have tested. Compress once, from the original, because each repeated lossy save adds more damage.
  6. Remove extra data if the tool offers it. Photographs can carry embedded details such as camera settings and sometimes a location, which add weight and may be better left unpublished.
  7. Name the file in plain words, with the right extension.
  8. Upload it and check what your platform did to it. Some systems recompress or resize on upload.
  9. Test the page and compare it with the result from before.

Tools and automation

You can compress by hand in an image editor, with a desktop or web tool made for the job, or automatically. Automation helps most when several people upload pictures. web.dev's guidance on images describes build tools, plugins in content management systems and image delivery services that resize, convert and compress images for you. Ask your developer what your site already does, because some setups create several sizes on upload and some do not. Automation cannot recover a blurry photograph, so the originals still need to be sensible.

This guide does not name tools, because the right choice depends on your platform and on who uploads the pictures.

How the page should load images

Good files can still load badly. A developer sets most of the following, and it is worth asking whether they are in place.

  • Responsive markup lets the browser choose between several sizes of the same image, so a phone does not download the desktop version. web.dev describes the srcset and sizes attributes for this.
  • Width and height attributes on every image let the browser reserve space before the file arrives, which stops the page jumping as pictures load. web.dev recommends them on images and video, or reserving the space with CSS.
  • Lazy loading delays pictures lower on the page until a visitor scrolls near them. Do not apply it to the main picture at the top of the page. web.dev advises leaving the image most likely to be the biggest one in view out of lazy loading, and Google's documentation on lazy-loaded content says not to lazy-load content that is likely to be visible straight away. Check that lazy-loaded images still appear in the page's HTML, so that search engines can find them. The URL Inspection tool in Google Search Console can show you.
  • The main image can be given a higher loading priority with an attribute called fetchpriority. Use it on the main image only.

Common image mistakes

  • Uploading a photograph straight from a phone or camera and letting the page shrink it on screen. The browser still downloads the full file.
  • Saving screenshots or logos as JPEG, which leaves blur around edges and text.
  • Using PNG for photographs, which makes files heavier than they need to be.
  • Compressing an already compressed JPEG again and again.
  • Putting text inside a picture. Screen readers and search engines cannot read it as text, and it scales badly. Use real text.
  • Filling a slider with many big pictures that few visitors ever see.
  • Leaving out alt text. Describe each meaningful image in a short phrase for people who cannot see it. Purely decorative images can have an empty description.
  • Keeping a camera file name such as IMG_0023 where a short descriptive name would help. Google's image guidance suggests short, descriptive file names.

Who does what in a website project

Image work is shared. You supply original photographs and graphics at good quality and on time. The designer or developer decides the slot sizes, builds the responsive markup and sets how the platform processes uploads. Late or poor pictures are a common cause of delay, as the guide on how long it takes to build a website explains, and the website development process guide shows who prepares which assets at each stage. The page types in your plan also decide how many image sizes you need, so it helps to list them while you plan the website structure and page hierarchy.

Image files live on your hosting account or with a delivery service, so storage and data limits can apply. The guide to domain name, website and hosting explains what each part is. A developer can set image handling up so that editors upload once and the site produces the right sizes. The website development service page describes the websites Liftup builds.

Questions and answers

What size should website images be?

Export each image no bigger than the space it fills on the page, and allow extra width for high-density screens. Ask your designer or developer for the widest slot of each image type, such as banner, card or product picture. Do not upload camera originals and let the page shrink them, because the browser still downloads the full file.

Which image format should I use?

Use JPEG, WebP or AVIF for photographs, PNG or lossless WebP for screenshots and flat graphics, and SVG for logos and icons. JPEG is the dependable default, and AVIF is used with a fallback because support has been less wide. Check browser support in the current documentation before relying on a newer format.

How do I compress images without losing quality?

Resize first, pick the right format, then lower the quality setting until you can just see damage and go back one notch. Judge the result at the size it will appear, on a phone as well as a computer. Compress once from the original, because repeated lossy saves degrade the picture.

Does image size affect SEO?

Heavy images slow pages down, and Google's page experience documentation points site owners to Core Web Vitals, for which images are a common cause of slow loading. Images can also bring visits through Google Images, where descriptive file names and alt text help. Compress for visitors first and treat any search benefit as a by-product.

Should I lazy-load every image?

No. Lazy loading suits pictures lower on the page, but the main image at the top should load straight away. Google's documentation advises against lazy-loading content that is likely to be visible immediately. Check that lazy-loaded images still appear in the page's HTML so search engines can find them.

Do I need different images for phones?

You need different sizes of the same picture, not different pictures. Responsive image markup lets the browser pick a smaller file on a small screen and a larger one on a high-density display. Ask your developer or check your platform, because without it a phone may download the desktop version.

See your new homepage before you commit.

A free, private homepage concept built from your own words and photos within 48 hours.

Get a free concept