Opens in a new tab

How to Optimize Images for SEO: A Peak Marketing Guide to Alt Text, File Names, and Compression

· @Peak Marketing

Image SEO comes down to a few habits you repeat on every upload. Name the file in plain words before it reaches your media library. Write alt text that says what the image actually shows. Resize and compress the file so it loads fast without turning blurry. Do this consistently and your images can appear in Google Images and beside regular search results, and they stop slowing your pages down.

At Peak Marketing, image cleanup is one of the first things we look at on a new law firm website. Images are rarely the reason a site ranks. They are often the reason a site loads slowly. A homepage photo pulled straight off a phone can weigh 4 or 5 MB, and that single file can take longer to load than the rest of the page combined.

Why Images Affect Your Search Visibility

Google shows images in more places than the Images tab. A thumbnail can appear next to a text result, inside Google Discover, or in an image pack on the main results page. Google applies the same general recommendations to all of these features, so one set of good habits covers every placement.

Speed is the other half of the picture. Google’s own documentation notes that images are often the largest contributor to a page’s total size. On most service pages, the largest visible element is a hero photo. That element sets your Largest Contentful Paint (LCP), a Core Web Vitals metric. Google considers an LCP of 2.5 seconds or less to be good. An oversized hero image is the most common reason we see pages miss that mark.

Name the File Before You Upload It

Google says a file name gives it only light clues about an image’s subject. Light clues still count, and the fix takes ten seconds. Use a few lowercase words separated by hyphens that describe what is in the picture.

Instead ofUse
IMG_4471.jpgcar-accident-intersection-boise.jpg
Screen Shot 2026-03-14.pngidaho-statute-of-limitations-chart.png
headshot-final-FINAL2.jpgattorney-sarah-lane-headshot.jpg

Rename files on your computer first. WordPress and most other platforms build the image URL from the original file name, and renaming after upload usually means re-uploading and replacing the image everywhere it appears.

A few related rules keep things clean. The file extension should match the actual format, so a WebP file should end in .webp. When the same image appears on several pages, reference the same URL each time so Google can cache it instead of fetching duplicates. Keep the name honest, too. A string like best-injury-lawyer-idaho-injury-attorney.jpg reads as keyword stuffing and helps no one.

Write Alt Text That Describes the Image

Alt text is the most important piece of image metadata, according to Google. It serves two audiences. Screen readers read it aloud to visitors who cannot see the image, and Google combines it with computer vision and the page’s text to work out what the image shows. When an image is used as a link, its alt text also acts as the anchor text.

Good alt text describes the image the way you would describe it over the phone. Here is how the same team photo looks at four levels of quality:

  • Missing: <img src=”team.jpg”>
  • Stuffed: alt=”lawyer attorney law firm injury lawyer best lawyer Idaho”
  • Vague: alt=”team”
  • Useful: alt=”Four attorneys standing on the steps of the Twin Falls County Courthouse”

The useful version names who is in the photo and where they are. It does not open with “image of,” since screen readers already announce that it is an image. Aim for one clear sentence.

Use your target keyword only when it genuinely describes the picture. A photo of a crash scene on a car accident page can reasonably mention a car accident. A photo of a coffee mug cannot.

Purely decorative images, such as background flourishes or divider graphics, should carry an empty alt attribute (alt=””) so screen readers skip them. Charts and infographics need the opposite treatment: summarize the main takeaway in the alt text and put the full data in the surrounding copy.

How to Compress and Resize Images Step by Step

Compression is where most of the speed gains live. This is the process we follow for client sites:

  1. Resize to the size it will display. If your blog column is 800 pixels wide, a 4,000-pixel camera photo wastes most of its weight. Export at about twice the display width (1,600 pixels here) so it stays sharp on high-resolution screens.
  2. Pick the right format. WebP or AVIF work well for photos. PNG suits graphics with transparency or fine text. SVG is best for logos and icons. Google supports BMP, GIF, JPEG, PNG, WebP, SVG, and AVIF.
  3. Compress the file. A quality setting between 75 and 85 is usually invisible to the eye on photos. Squoosh and TinyPNG handle single files, and WordPress plugins like ShortPixel or Imagify can process an entire media library. Our working target is under 150 KB for in-content images and under 250 KB for a hero image.
  4. Serve responsive versions. The srcset attribute lets the browser choose a smaller file on phones. Keep a standard src as a fallback, since Google recommends one for crawlers that ignore srcset.
  5. Lazy load what sits below the fold. Add loading=”lazy” to images further down the page, but never to the hero image. Lazy loading your largest visible image delays LCP instead of improving it.
  6. Set width and height. Declaring dimensions reserves space on the page so text does not jump as images load.
  7. Test the result. Run the page through PageSpeed Insights before and after. It will flag oversized images and confirm which element is your LCP.

What Peak Marketing Checks Beyond the Basics

File names, alt text, and compression handle most of the work. A handful of technical details decide whether Google can find and use your images at all.

Use real image elements

Google finds images in the src attribute of an <img> tag. It does not index images set as CSS backgrounds. Many page builders place hero photos as background images by default, which makes them invisible to image search. If a photo matters, embed it as a standard image.

Keep images close to related text

Google reads captions, nearby headings, and surrounding paragraphs to understand an image. A photo of your office belongs on your contact or about page, near the copy that mentions your location. A caption under an important image gives Google one more clear signal.

Choose the image Google shows for the page

You can suggest a preferred thumbnail through the og:image meta tag or the primaryImageOfPage property in schema markup. Google advises against using your logo or an image packed with text for this. Pick a high-resolution photo that represents the page.

Add an image sitemap if you use a CDN

An image sitemap helps Google find images it might otherwise miss. It can also list image URLs hosted on another domain, which matters if your site serves media from a content delivery network.

One last observation from our audits: original photos of your real team and office tend to outperform stock images with visitors. They also give you something unique to describe in your alt text.

Make Image SEO Part of Every Upload

Image optimization works best as a routine, not a one-time cleanup. Rename the file, write a real description, and shrink it to the size the page needs. Then check that the image is a standard element sitting near text that explains it. Those few minutes per image add up to faster pages and more chances to show up in search.

If your media library is full of IMG_ files and multi-megabyte photos, the Peak Marketing team can audit your images as part of a technical SEO review and fix what is slowing your site down. Reach out to our team to get started, with no long-term contract required.

Sources

  1. Google Search Central, Google image SEO best practices
  2. W3C Web Accessibility Initiative, Images Tutorial
  3. web.dev, Largest Contentful Paint (LCP)
  4. web.dev, Responsive images
  5. Core Web Vitals, Optimize the Largest Contentful Paint Image
  6. Google, PageSpeed Insights

Related posts