Performance

Optimise Images for a Website

Optimise website images by choosing the right dimensions, compressing safely, using descriptive alt text and reserving enough layout space so images do not slow down or destabilise the page.

What this workflow solves

Target outcome

A faster, cleaner image workflow with smaller files, clearer accessibility text and fewer layout surprises.

Work through Image optimisation

Track each step, focus the current task and copy a starter outline for your project notes or implementation plan.

0% complete
Decide the image job

Not every image needs the same treatment. Product images, screenshots, avatars and decoration have different requirements.

  • Keep informative images sharp enough to inspect.
  • Avoid uploading huge originals when the rendered size is small.
  • Use decorative images sparingly and keep them lightweight.
Starter codeCopy and adapt this outline for the workflow.
<section aria-labelledby="optimise-images-for-website-title">
  <p>Image optimisation</p>
  <h2 id="optimise-images-for-website-title">Optimise Images for a Website</h2>
  <p>A faster, cleaner image workflow with smaller files, clearer accessibility text and fewer layout surprises.</p>
  <ol>
    <li>Decide the image job</li>
    <li>Resize and compress before upload</li>
    <li>Prevent layout shift</li>
  </ol>
</section>

Work this way

These are the patterns that keep the workflow practical, accessible and easier to maintain.

Keep informative images sharp enough to inspect.
Resize images near the largest display size needed.
Set width and height or aspect-ratio where practical.

Avoid these traps

Uploading oversized images and expecting the browser to solve the cost.
Optimising visual effects before checking the biggest page assets.
Lazy-loading content that belongs in the first viewport.

Step-by-step workflow

Follow the steps in order, then use the resource sections when you need a tool, reference or UI pattern.

1

Decide the image job

Not every image needs the same treatment. Product images, screenshots, avatars and decoration have different requirements.

  • Keep informative images sharp enough to inspect.
  • Avoid uploading huge originals when the rendered size is small.
  • Use decorative images sparingly and keep them lightweight.
2

Resize and compress before upload

Large images can dominate page weight even when the rest of the site is efficient.

  • Resize images near the largest display size needed.
  • Compress while checking visible quality.
  • Keep originals outside the production asset folder when possible.
3

Prevent layout shift

Images should not push content around after they load.

  • Set width and height or aspect-ratio where practical.
  • Use responsive image rules for different viewports.
  • Avoid lazy-loading images that are needed in the first viewport.

Tools, cheatsheets and components

Use these linked DevKitYard sections when the guide moves from planning to doing.

Place optimised images in ElementYard

Use ElementYard to test how optimised images fit inside hero, card and avatar layouts.

Open ElementYard

Image optimisation questions

Should I compress every website image?

Yes, but inspect quality after compression. The goal is smaller files without damaging images users need to understand.

Do decorative images need alt text?

Decorative images should usually use empty alt text so assistive technology can skip them.