Files and performance
Optimize images and PDFs for the web without losing usability
Choose format, dimensions and compression by purpose, then verify quality, accessibility, metadata and download behavior.
In short
The smallest file is not automatically the best file. Optimize for the user’s task: preserve readable content, choose a format supported by the delivery context, resize to realistic dimensions and compress until the next reduction causes visible or functional harm. Verify the result independently before replacing the original.
- Resize oversized media before increasing compression.
- Choose format by content and compatibility, not trend alone.
- Compare quality at the actual display size.
- Keep accessibility and document behavior during optimization.
- Review metadata and preserve the original until approval.
1. Define the delivery goal
Separate hero photography, interface screenshots, transparent graphics, logos, scanned documents and text-first PDFs. Each has different quality and format needs. Record the intended viewport, maximum display width, download expectation and acceptable visual change.
Create a baseline: original dimensions, byte size, page count, color behavior, text selection, links and metadata. Without a baseline, a smaller output may hide broken transparency, unreadable labels or flattened form fields.
- Content type identified
- Target display size recorded
- Original size and behavior measured
- Recoverable source copy preserved
2. Choose an image format deliberately
JPEG remains useful for photographic content; PNG is appropriate when lossless detail or alpha transparency matters; WebP and AVIF can provide efficient modern compression where the target environment supports them; SVG suits vector artwork from trusted sources.
Format conversion does not restore detail already lost. Animated content, color profiles, transparency and metadata may change. Keep a fallback when audience, email client, editor or downstream platform support is uncertain.
3. Resize before aggressive compression
A 4000-pixel image displayed at 800 pixels transfers detail the page cannot show. Resize near the largest expected rendered size, retain aspect ratio and generate responsive variants when the site can select among them.
Then adjust quality in small steps. Compare edges, gradients, text and faces at actual size, not only zoomed in. A byte target is useful, but the stopping point is when further savings damage the task or brand.
- Aspect ratio preserved
- Largest rendered size covered
- Text and edges remain legible
- Transparent areas render correctly
4. Optimize PDFs without breaking documents
PDF compression may downsample images, subset fonts or remove redundant objects. Open the output in an independent viewer and test page order, selectable text, search, links, bookmarks, forms, signatures and print behavior as applicable.
Scanned PDFs need enough resolution for reading and any authorized OCR workflow. Accessibility depends on document structure, reading order, labels and alternatives, not merely low file size. Do not claim a compressed file is accessible without checking those properties.
5. Publish and monitor the result
Use descriptive filenames, correct MIME types, explicit width and height for web images and useful alternative text when the image conveys information. Avoid placing essential text only inside an image.
After deployment, test on a constrained mobile connection and confirm the right file is delivered. Review metadata before public release, but preserve rights and provenance fields that your workflow requires. Keep the original in controlled storage until the optimized asset is accepted.
Next step
Check your own case
Frequently asked questions
Which image format is always best?
None. Content, transparency, animation, browser or platform support and editing needs determine the appropriate format.
Should I compress before resizing?
Usually resize first when dimensions greatly exceed display needs, then tune compression on the correctly sized output.
Does a smaller PDF remain accessible?
Not necessarily. Compression can preserve or damage structure. Test reading order, text, links, forms and assistive-technology requirements.
Can I delete metadata safely?
Review it field by field. Remove unnecessary personal or device data but preserve rights, accessibility or records information required by your process.
Primary sources and reference
Sources consulted during editorial review. External links open the organization responsible for the standard or guidance.