---
schema_version: "1"
id: e1a3cbb216ee72b1ec59a6066d07cae6527213550e0bd9581711534c20b16b94
title: Optimize Images
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/best-practices/best-practices-performance/pages-best-practices-perf-images.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-images.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 15521ff14df12aa65398ebe8b5a7877dae1f6a0e59eea2edc0d3b98fea3a75bd
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Optimize Images

Images are frequently the largest components of a web page, so they significantly affect a Visualforce page’s performance.

To minimize the performance impact of images:

-   Use fewer images and smaller background textures.
-   Use CSS instead of images whenever possible.
-   Use CSS sprites instead of individual images. With CSS sprites, you can combine a collection of similarly sized graphics, such as buttons and icons, into a single file. Then you can use the CSS `background-image` and `background-position` properties to display portions of the combined image. Because this technique reduces the number of images used, the number of HTTP requests sent also decreases. It’s also more efficient to cache a sprite file than to cache multiple images.
-   Use static resources to serve images. Images served this way benefit from the caching and the content distribution network (CDN) built into Salesforce.
-   Compress images. Graphics tools often use default settings that favor visual fidelity over compression and add metadata when saving images. Image compression tools can reduce an image’s file size by up to 30% without lowering visual quality.

**tip:** To improve your development workflow, add a script that compresses image assets.

**See Also**  


-   [Using Static Resources](https://developer.salesforce.com/docs/platform/resources/pages-resources.md)

