Performance
Images for the web
Choose formats, dimensions and alternative text.
On this page
Choose the appropriate format
SVG works well for diagrams and icons; WebP or AVIF can reduce photographic image sizes. PNG remains useful for lossless graphics.
Provide suitable dimensions
Width and height attributes allow browsers to reserve layout space. Use responsive source sets when different viewport sizes need different image resolutions.
Describe the purpose
Informative images need meaningful alternative text. Decorative images should use an empty alt attribute so assistive technology can skip them.
Example
<img src="diagram.svg" width="640" height="360"
alt="Three steps in the publishing workflow">