Guides

Preparing images for the web: a practical checklist

The order of operations that matters, and why resizing beats every other optimisation.

On a typical web page, images account for more bytes than the HTML, CSS, JavaScript and fonts combined. They are also the easiest thing to fix, because most image weight on the web comes from pixels nobody will ever see and very little from compression waste.

This is the order of operations that gets the most improvement for the least work.

Step 1: resize first

Before you touch a format or a quality slider, check the image’s dimensions against the space it will occupy.

A photo straight off a phone is around 4000 pixels wide. Displayed in an 800-pixel column on a page, roughly 96% of its pixels are discarded by the browser at render time, after being downloaded, decoded and held in memory. You paid for all of them.

The arithmetic is brutal in your favour. Halving both dimensions quarters the pixel count, and file size follows roughly. A 4000px photo resized to 1600px is often a tenth of the original weight before you have made a single compression decision. No amount of clever encoding competes with not sending pixels nobody sees.

To decide how big is big enough, take the largest size the image will actually be displayed at in CSS pixels, then multiply by 2 for high-density screens. An image in an 800px column needs about 1600px of source. A full-width hero on a desktop layout needs maybe 2400-3000px. A thumbnail in a 200px grid cell needs 400px, not 4000.

Going beyond 2× is nearly always waste. The visible improvement from 3× is negligible on real content and the file size is not.

Step 2: choose the format for the content

With the dimensions right, pick the format based on what the image is, not on what it currently is:

  • Photographs: consider WebP and compare its weight and visible loss with JPG. Supported by every browser released since 2020. Fall back to JPG only if your audience includes people opening files in old desktop software.
  • Screenshots, diagrams, charts, line art: PNG, or lossless WebP. Sharp edges and flat colour are exactly what JPEG handles worst, and text in a JPEG screenshot picks up visible grey halos.
  • Logos and icons: SVG if you have the vector. It is usually smaller than any raster version and stays sharp at every size and density. Use PNG if you only have pixels.
  • Anything needing transparency: PNG, WebP or AVIF. JPG has no alpha channel at all.

There is a fuller comparison if the choice is not obvious.

Step 3: pick a quality level deliberately

Warm (0.85) is this site’s starting setting. Try Cold (0.60) for fewer bytes or Hot (0.95) when detail suffers, then compare at the intended display size. No setting promises invisible loss or a fixed saving. The downloadable comparison records all three settings on synthetic patterns, including cases where converting makes a file larger. What the numbers actually control covers the mechanism.

Step 4: strip the metadata

A photo from a phone carries EXIF data: camera model, exposure settings, timestamps and frequently GPS coordinates accurate to a metre. Publishing it unchanged publishes all of that.

This is a privacy issue first and a size issue second, though the size is real: metadata blocks with embedded thumbnails can run to tens of kilobytes per file. Any format conversion removes it as a side effect of re-encoding, since the new file is built from pixels and never copied from the old one. What is in there is worth reading once if you publish photos you took yourself.

Step 5: set width and height in the HTML

This one costs nothing and fixes a real problem.

<img src="photo.webp" width="1600" height="900" alt="…">

With the intrinsic dimensions declared, the browser reserves the correct space before the image loads. Without them, the page reflows as each image arrives, so text jumps and someone taps the wrong link. Cumulative Layout Shift, one of Google’s Core Web Vitals, measures that instability directly, and it is one of the few page-speed problems with a trivial fix.

The attributes coexist fine with responsive CSS. Add img { height: auto; } to your stylesheet and the aspect ratio is preserved while the width stays fluid.

Step 6: lazy-load what is below the fold

<img src="photo.webp" loading="lazy" width="1600" height="900" alt="…">

loading="lazy" defers the download until the image is near the viewport. On a long page this can cut initial load dramatically.

The important exception is the hero image and anything visible without scrolling, which you should not lazy-load. Lazy-loading an above-the-fold image delays the very thing the page is judged on and measurably worsens Largest Contentful Paint. Load the first screen eagerly and lazy-load the rest.

Step 7: write real alt text

Alt text is an accessibility requirement and belongs to more than SEO. The test is simple: if the image did not load, would this sentence tell someone what they were missing?

  • Informative images get a description of what they show and why they are there: alt="Bar chart showing conversion rates rising from 2% to 7% over six months".
  • Purely decorative images get alt="", an empty attribute, present but blank, which tells a screen reader to skip it entirely. Omitting the attribute is a different thing, and some screen readers then read out the filename.
  • Images that are links describe the destination and leave the picture undescribed.

Avoid “image of”, avoid keyword stuffing, and keep it to a sentence.

The checklist

  1. Resize to no more than 2× the largest displayed size.
  2. Choose the format by content: WebP for photos, PNG for graphics, SVG for logos.
  3. Start at Warm, compare the result, then adjust if needed.
  4. Strip metadata. Conversion does this automatically.
  5. Declare width and height on every <img>.
  6. Lazy-load everything below the fold, and nothing above it.
  7. Write alt text that would stand in for the image.

An illustrative sizing decision

Suppose a 4032 × 3024 phone image will appear in a 700px-wide article column. A 1400px-wide delivery copy can supply two image pixels per CSS pixel at that width. Resize in an editor first; Jaypegery does not resize. Then compare JPG and WebP output, record the actual bytes, and inspect detail at the intended display size. Pixel dimensions alone do not predict the resulting file weight or whether compression will be visible. Declare the final dimensions and lazy-load if it is below the fold.

Where this site fits

Jaypegery handles the format conversion and the metadata stripping, in your browser, without uploading anything. It does not resize. That is deliberate, since the right dimensions depend on a layout only you can see, and a converter that silently downscales your image has ruined an archive copy for someone.

So do the resize in whatever editor you already have, then bring the result here for the format conversion. The finished ticket reports the real output weight, which is the number to check your work against.