How to optimize images for SEO: size, format and alt text

A photographer on a Costa Rican beach takes photos that travel to a laptop, with a magnifying glass over a toucan photo

Images are usually the heaviest part of a website, and one of the most neglected. A 5 MB photo uploaded straight from a phone can add seconds to a page's load time. And an image with no description is invisible to Google Images and to people who use screen readers.

The good news: optimizing images is one of the simplest SEO wins. This guide covers what to check and how to do it.

Why images matter for SEO

  • Speed: heavy images are the most common cause of slow pages, and speed affects both the user experience and how Google assesses your site.
  • Google Images: plenty of searches for products, places and recipes start there.
  • Context: alt text and the copy around an image help Google understand what the page is about.
  • Accessibility: people with visual impairments rely on alt text.

1. The right dimensions

A balance scale with one large, heavy image on one side and three small images on the other, evenly balanced

A camera or phone takes photos 4,000 pixels wide or more. Almost no website displays them wider than 1,600.

  • Resize before uploading. As a rule of thumb: 1,600 pixels for full-width images, 1,200 for images inside an article, 800 for thumbnails.
  • Aim for a sensible file size: under 200 KB for large photos and under 100 KB for in-article images is usually doable with no visible difference.
  • Don't use a large image to show it small. If a thumbnail displays at 400 pixels, upload it at that size (or double, for high-density screens).

2. The right format

  • WebP: the recommended format for most cases. Much lighter than JPG or PNG at the same quality, and supported by every current browser.
  • AVIF: lighter still, though some tools and platforms don't handle it well yet.
  • JPG: for photos, if your platform doesn't accept WebP.
  • PNG: only for graphics with transparency or very crisp text.
  • SVG: for logos and icons, because they look sharp at any size.

Many platforms (WordPress with a plugin, Shopify, Wix) convert images to WebP automatically. Check whether yours does before converting by hand.

3. Compress without losing quality

Compression shrinks the file. Free tools like Squoosh or TinyPNG do it in seconds. A quality setting of 75 to 85 is usually invisible to the eye and cuts the file size in half or more.

4. File names that mean something

IMG_4382.jpg tells Google nothing. arenal-volcano-tour-sunset.webp does.

  • Use words that describe the image, separated by hyphens.
  • Avoid accents and special characters in file names, which can cause problems on some servers.
  • Don't stuff the name with keywords; describe what's in the picture.

5. Alt text

A woman places descriptive labels under framed pictures of a volcano and tropical plants while a magnifying glass inspects one label

Alt text describes an image for anyone who can't see it: a person using a screen reader, or Google's crawler.

How to write it:

  • Describe what's shown and why it's on the page: "Double room with an ocean view at a hotel in Manuel Antonio".
  • Keep it specific and short: one sentence is usually enough.
  • If it fits naturally, include the page's target search, but only if it actually describes the image.
  • Don't start with "image of" or "photo of".

When to leave it empty: for purely decorative images (backgrounds, dividers), use an empty alt so screen readers skip them.

What not to do: "SEO agency Costa Rica cheap SEO best SEO". That describes nothing, helps nobody, and Google recognizes it as filler.

6. Lazy loading and dimensions

  • Lazy loading: images further down the page load only when the visitor scrolls near them. In HTML, loading="lazy" is all it takes. Don't use it on the main image at the top, which should load right away.
  • Declared width and height: set width and height on every image so the page doesn't jump around while loading. That jump is measured as CLS in Google's metrics.

We go into more detail in website speed.

7. Context: the image and its text

Google understands an image better when it sits next to text about it. A photo of today's special beside the paragraph describing it is worth more than a 40-photo gallery with no text.

If your business depends on images (hotels, restaurants, real estate, online stores), consider:

  • Captions where they add information.
  • Product or business structured data with the main image (see structured data explained).
  • Your own photos instead of stock images: Google and customers can tell the difference.

Quick checklist before uploading an image

  1. Did I resize it to the size it will be displayed at?
  2. Is it WebP (or a compressed JPG)?
  3. Is it under 200 KB?
  4. Does the file name describe the image?
  5. Does it have useful alt text?
  6. Does it have a width and height, and lazy loading if it's further down?

Frequently asked questions

Do AI-generated images hurt SEO?

Google doesn't penalize images for being generated; it looks at whether they're useful. To show your business, products or team, real photos build more trust.

Should I optimize the images already on my site?

Yes, especially on your most-visited pages. Start with the heaviest images: there are usually only a few, and they account for most of the problem.

Does Google read text inside an image?

It can recognize some, but don't rely on it. Important text (prices, hours, headings) should be written on the page, not only in an image.

How many images should an article have?

As many as help people understand it. Two or three useful images beat ten decorative ones.

Is your site slow?

In our Technical SEO & content plan we review your site's speed, images and structured data. See our prices or start with an SEO audit.

Get your SEO plan

What do you need?

We reply on WhatsApp or by email. We never share your details.

Rather talk first? Book a free video call or price your project.

Keep reading