Is your website running slowly? Are you paying too much for bandwidth? If so, you may need to compress your JS files. Read on for more information about how to do this and how it will benefit your website.

What are .js Files?

JS files are text files that contain JavaScript code that is used to execute JavaScript instructions on webpages in order to change HTML and CSS content, attributes, and style. While many programmers place the JavaScript code directly into the HTML head or body, many others prefer to keep the JavaScript that they use on their website in an external file for the practicality of being able to use the same code for many different pages. JavaScript is the programming language that is commonly used to add dynamic and interactive elements to websites, such as:

  • Functions that open and close windows
  • The ability validate form fields
  • The enabling of rollover images
  • The creation of drop-down menus
  • The ability to add animated 2D or 3D graphics

In order to understand what these very common files do, consider some of the functions you regularly use on the internet. When you begin searching for something on Google, you will receive suggested search terms after you've typed a character or two into the search bar. This is because of a JS file. When Facebook automatically updates your newsfeed, this is also a function of JavaScript. If you're creating mobile applications or web browser-based games, your finished product will contain .js files, and these files will hopefully be compressed.

JavaScript was initially created in around 1995 and was used in the Netscape Navigator web design tool. Nearly all websites now use JS either internally in HTML code or through external JS files.

Why to Compress JS Files

During the writing of the JavaScript code, the very human programmers place white spaces into the code as a way to mark certain areas for ease in debugging. However, while these additional spaces and other unnecessary characters in the script do not impact the ability of the file to run, they do create larger files. These larger files can slow download time and negatively impact the overall performance of the website. Removing these unnecessary characters is often referred to as minification.

compress of JS files also includes reducing duplication in a dataset by detecting repeating patterns and replacing them with more efficient coding in order to reduce the bytes needed to store and transmit the dataset. This will provide quicker download times for your users and reduced bandwidth consumption on your website, as well as reducing server load and allowing for more visitors to access your site.

How to Compress JS Files

The right software can enable you to easily compress JS files in one or more of the following ways:

  • Removing white spaces and indentions in the text
  • Shortening variable names to single characters
  • Turning arrays to objects whenever possible
  • Removing new line characters
  • Joining closely placed variable declarations
  • Optimizing conditional statements
  • Removing comments that were inserted during the writing of the code

How to compress JS files in WinZip

From File Explorer:

  1. From your File Explorer select all of the files you want to compress.
  2. Right-click on the selected files. WinZip > Add/Move to Zip File… This will open WinZip with options about how you want your file zipped.
  3. Select your file options, like name, location, encryption, and any other features you want to include.
  4. Select Add. This will create a zip file in the location you selected containing all your files.

From within WinZip:

  1. From within WinZip, locate the files you want to zip using the panel on the left.
  2. Select all of the files you want to compress.
  3. Select the Add to Zip button at the bottom of the left panel.
  4. After you add all of the files you want to the Zip file, select the "Save as" button in the right bottom corner. Name your file and select save.

Note: Certain file types do not compress as much as others. You must have WinZip installed on your computer to use these methods.


Large files make it hard for websites and devices to run. Millions of businesses and consumers worldwide turn to WinZip in order to obtain the tools and resources needed to ensure that the files used to run their websites and other programs are properly compressed, enabling the saving of computer storage space, bandwidth space, and boost productivity through increased efficiency. Take a look at the products we offer, and you will quickly see why we are the world's leading provider of encryption and compress software.

Download Winzip and Encrypt Files Today