What Is a ZIP File?
A ZIP file is an archive file that can combine multiple files and folders into a single package. It can also compress the data inside, reducing the amount of storage space required and making collections of files easier to transfer.
ZIP is an archive format
A ZIP file is an archive that can contain one or more files and directories.
The contents can be stored together inside a single file ending in the .zip extension.
ZIP also supports lossless compression, allowing many types of data to be stored using fewer bytes.
Several files can become one archive
Suppose a folder contains:
The entire folder could be packaged as:
Instead of sending four separate files and their folder structure, you can send a single archive.
ZIP preserves files and folders together
A ZIP archive can preserve directory structure.
When the archive is extracted, the original folder structure can be recreated.
ZIP files can compress data
Compression attempts to represent the same information using fewer bytes.
The amount saved depends heavily on the type of data being compressed.
ZIP compression is lossless
Lossless compression means the original information can be reconstructed exactly when the archive is decompressed.
No content needs to be deliberately discarded. This is different from lossy formats that may remove information to achieve smaller file sizes.
Not every file becomes much smaller
Text-based files often compress very effectively because they can contain repeated patterns.
Files that are already compressed may shrink very little.
In some cases, placing already compressed data inside a ZIP archive may produce almost no size reduction.
ZIP can also store files without compression
A ZIP archive does not require every file inside it to be compressed.
Entries can also be stored directly while still benefiting from the archive structure.
What does "extract" mean?
Extracting a ZIP file means taking files out of the archive and restoring them as ordinary files and folders.
The ZIP archive itself can remain unchanged after extraction.
What does "zip" a folder mean?
To zip files means to package them inside a ZIP archive.
Operating systems such as Windows and macOS include built-in tools for creating and extracting ZIP archives.
A ZIP file contains multiple file records
Internally, ZIP stores information about the files inside the archive.
This can include:
ZIP files contain a central directory
A ZIP archive normally contains a central directory describing the entries stored inside it.
Software can use this information to find and list the archive's contents.
ZIP files can detect some forms of corruption
ZIP entries commonly include a CRC-32 checksum.
The checksum can be used to check whether extracted data matches the data expected by the archive.
ZIP archives can be password-protected
Some ZIP tools support encryption so that the archive contents cannot be read without the required password.
Password protection and compression are different things. Compression reduces or packages data. Encryption is intended to protect data from unauthorised access.
ZIP is also used as a container for other file formats
Some file formats are actually specialised ZIP packages.
| Format | What it contains |
|---|---|
| .xlsx | Excel workbook XML and supporting files |
| .docx | Word document XML and supporting files |
| .pptx | PowerPoint XML and supporting files |
These formats use ZIP as the underlying package containing multiple structured files.
An .xlsx file is a specialised ZIP package
This is why renaming a copy of an .xlsx file to .zip can allow ZIP software to inspect its internal structure.
A ZIP archive is not the same as a normal folder
| Folder | ZIP archive |
|---|---|
| Directory on a file system | Single archive file |
| Contains files directly | Packages entries inside the archive |
| No compression by itself | Can compress contained files |
| Easy to edit directly | Usually extracted or modified with archive software |
ZIP is one of several archive formats
These formats have different features, compression methods and levels of software support.
ZIP is particularly widespread because support is built into many operating systems and applications.
Software can create ZIP files automatically
Programming languages can create, inspect and extract ZIP archives.
Python can create ZIP archives
The program creates an archive and adds files to it.
ZIP files are useful in automated workflows
This makes ZIP useful for exports, backups, downloadable packages and batch processing.
ZIP files are commonly used for backups
A group of related files can be bundled into one archive:
This makes the collection easier to copy, store and transfer.
ZIP files make collections easier to send
Instead of attaching twenty separate files to a message, they can be placed inside one archive.
ZIP files should still be treated carefully
A ZIP archive can contain almost any type of file, including executable programs and scripts.
Receiving a file inside a ZIP archive does not make that file automatically safe.
Only extract and run files from sources you trust. An archive is simply a container and does not guarantee that its contents are harmless.
What are ZIP files used for?
The simplest way to think about a ZIP file
Many files. One package.
A ZIP file is an archive format that can package multiple files and folders into a single file. ZIP supports lossless compression, preserves directory structures and is widely used for transfers, backups, downloads and software packaging. Some formats such as XLSX, DOCX and PPTX also use ZIP internally as their container format.