How to Resize Images for Websites

Match image files to the slot they fill: favicons, Open Graph images, blog cards, and full-width photos, without uploading a camera original.

Websites feel slow when an article image is a 4000-pixel camera file displayed at 800 CSS pixels. The browser still downloads every pixel. Resize the file to the slot, then compress it.

Three sizes that cover most pages

  • Open Graph and other link previews: 1200×630. This is the image chat apps and social sites fetch when someone pastes a URL.
  • Blog cards and heroes: 1200×675, which is 16:9. A full-width article photo can go to 1600 or 2000 pixels on the long side if the layout is wide and you care about high-density screens.
  • Favicon: a simple 512×512 mark. Browsers scale it down. Export 32×32 only when a tool demands that exact file. Do not use a photograph.

Display size is not file size

CSS width controls how large the picture looks. The file’s pixel width controls how much data you ship and how sharp it can be. On a screen with twice the pixel density, a 600-pixel slot looks sharper with a 1200-pixel file. It does not look sharper with a 6000-pixel file.

When you know the layout, export at 1× or 2× the CSS size and stop. The image resizer shows the original pixel size next to the export size so you can see whether you are shrinking or enlarging.

Format

Photographs: WebP or JPEG. Interface images, logos, and screenshots with type: PNG, or a high-quality WebP if you have checked the edges. Transparency needs PNG or WebP. JPEG will fill transparent pixels with the background color you pick.

Set width and height in the HTML for the image, or reserve the space another way, so the page does not jump when the file arrives. That is a layout concern. Resizing the file does not do it for you.

For a longer pass on file weight, read how to optimize images for faster websites.

More guides