> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enabling data compression using the mod_deflate module

> Enable data compression with mod_deflate: Get instructions and code snippets for various hosting accounts.

This article describes how to enable data compression using Apache's **mod\_deflate** module. You can use the **mod\_deflate** module to compress output from your web site that is sent to client browsers. Using data compression can reduce page load times and the amount of bandwidth your site uses.

<Note>
  * Older versions of Apache used the **mod\_gzip** module for data compression. In practice, the **mod\_deflate** module for Apache 2 provides the same functionality as the **mod\_gzip** module.

  * The **mod\_deflate** module is already installed on shared hosting accounts, and we can install it on managed VPS and dedicated servers as well at your request. If you need further assistance, please open a support ticket at [https://my.hosting.com](https://my.hosting.com).
</Note>

## cPanel (managed) hosting accounts

To enable data compression on cPanel-based hosting accounts, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. Before enabling compression check that *zlib.output\_compression* is enabled by using the **Select PHP Version** tool. For complete instructions on changing PHP settings, please see [this article](/docs/changing-php-versions-and-settings-in-cpanel).

3. On the **Tools** page, in the **Software** section, click **Optimize Website**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-software-optimize-website-icon.png)

4. On the **Optimize Website** page, under **Compress Content**, select one of the following options:

   * **Compress All Content**: Select this option if you want to compress all of your content.

   * **Compress the specified MIME types**: Select this option if you want to compress specific types of content. In the **MIME Types** text box, type the MIME types that you want to compress.
     > 👍 Tip
     >
     > To view a complete list of MIME types, please visit [https://www.iana.org/assignments/media-types/media-types.xhtml](https://www.iana.org/assignments/media-types/media-types.xhtml).

5. Click **Update Settings**. The new settings take effect immediately. To verify that data compression is active, please see **Determining if compression is enabled** below.

## Unmanaged hosting accounts

For unmanaged hosting accounts, you must edit the *.htaccess* file to enable data compression. The following sample configuration demonstrates one way to enable data compression by specifying file extensions:

```
<IfModule mod_deflate.c>
    <filesMatch "\.(js|css|html|php)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</IfModule>
```

In this example, Apache compresses any file that has an extension of *.js*, *.css*, *.html*, or *.php*.

Alternatively, you can use MIME types to specify which files to compress. The following sample configuration demonstrates one way to do this:

```
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>
```

In this example, Apache compresses any file that uses one of the MIME types referenced by the **AddOutputFilterByType** directive.

<Tip>
  To view a complete list of MIME types, please visit [https://www.iana.org/assignments/media-types/media-types.xhtml](https://www.iana.org/assignments/media-types/media-types.xhtml).
</Tip>

To disable data compression, you can delete the relevant lines in the *.htaccess* file, or comment them out by preceding each line with **#**.

To verify that data compression is active, please see **Determining if compression is enabled** below.

## Determining if compression is enabled

To check if data compression is enabled on your site, go to [https://www.giftofspeed.com/gzip-test](https://www.giftofspeed.com/gzip-test), type your domain name in the text box, and then click **CHECK**. The site tells you whether or not compression is currently enabled.

## More information

For more information about the **mod\_deflate** module, please visit [http://httpd.apache.org/docs/2.4/mod/mod\_deflate.html](http://httpd.apache.org/docs/2.4/mod/mod_deflate.html).

## Related articles

* [Using .htaccess files](/docs/using-htaccess-files)
