---
schema_version: "1"
id: 32e2fc473ec1908ab9a30282ae9948b7bcc053713df9a7983d6b4b97d094d9f4
title: Static Resources
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/pages_static_resources.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.pages_static_resources.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 273c789633f36d0231415faee23b64e1b4b3d83b9b02bab28111d3dae1f1eb8f
description: Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files. Static resources can be used only within your Salesforce org, so you can’t host content here for other apps or websites.
products:
  - Salesforce Platform
release: "264"
---
# Static Resources

Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files. Static resources can be used only within your Salesforce org, so you can’t host content here for other apps or websites.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Contact Manager</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

Using a static resource is preferable to uploading a file to the Documents tab because:

- You can package a collection of related files into a directory hierarchy and upload that hierarchy as a .zip or .jar archive.
- You can reference a static resource in page markup by name using the `$Resource` global variable instead of hard-coding document IDs:
    - To reference a standalone file, use `$Resource.<resource_name>` as a merge field, where <resource\_name> is the name you specified when you uploaded the resource. For example:
        
        `<apex:image url="{!$Resource.TestImage}" width="50" height="50"/>`
        
        or
        
        ```markup
        <apex:includeScript value="{!$Resource.MyJavascriptFile}"/>
        ```
    - To reference a file in an archive, use the `URLFOR` function. Specify the static resource name that you provided when you uploaded the archive with the first parameter, and the path to the desired file within the archive with the second. For example:
        
        ```markup
        <apex:image url="{!URLFOR($Resource.TestZip, 'images/Bluehills.jpg')}" 
            width="50" height="50"/>
        ```
        
        or
        
        `<apex:includeScript value="{!URLFOR($Resource.LibraryJS, '/base/subdir/file.js')}"/>`
- You can use relative paths in files in static resource archives to refer to other content within the archive. For example, in your CSS file, named styles.css, you have the following style:
    
    ```html
    table { background-image: url('img/testimage.gif') }
    ```
    
    When you use that CSS in a Visualforce page, you need to make sure the CSS file can find the image. To do that, create an archive (such as a zip file) that includes styles.css and img/testimage.gif. Make sure that the path structure is preserved in the archive. Then upload the archive file as a static resource named “style\_resources”. Then, in your page, add the following component:
    
    ```markup
    <apex:stylesheet value="{!URLFOR($Resource.style_resources, 'styles.css')}"/>
    ```
    
    Since the static resource contains both the style sheet and the image, the relative path in the style sheet resolves and the image is displayed.

A single static resource can be up to 5 MB in size. An organization can have up to 250 MB of static resources. Static resources apply to your organization’s quota of data storage.

- **[Define Static Resources](https://help.salesforce.com/s/articleView?id=platform.pages_static_resources_create.htm&release=264.0.0&type=5)**  
    You can use static resources to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files. You can use static resources only within your org, so you can’t host content here for other apps or websites.
- **[View and Edit Static Resources](https://help.salesforce.com/s/articleView?id=platform.pages_static_resources_edit.htm&release=264.0.0&type=5)**  
    Edit, delete, and clone static resources.
- **[Manage Static Resources](https://help.salesforce.com/s/articleView?id=platform.pages_static_resources_manage.htm&release=264.0.0&type=5)**  
    After creating static resources, you can customize, edit, and delete them.

#### See Also

- [Define Static Resources](https://help.salesforce.com/s/articleView?id=platform.pages_static_resources_create.htm&release=264.0.0&type=5 "You can use static resources to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files. You can use static resources only within your org, so you can’t host content here for other apps or websites.")