Monday, September 21, 2026

What Is a ZIP File?

// file formats

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.

// definition

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.

// example

Several files can become one archive

Suppose a folder contains:

project/ │ ├── index.html ├── styles.css ├── script.js └── logo.png

The entire folder could be packaged as:

project.zip

Instead of sending four separate files and their folder structure, you can send a single archive.

// archive

ZIP preserves files and folders together

A ZIP archive can preserve directory structure.

website.zip │ ├── index.html │ ├── css/ │ └── styles.css │ ├── js/ │ └── app.js │ └── images/ └── logo.png

When the archive is extracted, the original folder structure can be recreated.

// compression

ZIP files can compress data

Compression attempts to represent the same information using fewer bytes.

Original files ↓ Compression ↓ Smaller ZIP archive

The amount saved depends heavily on the type of data being compressed.

// lossless

ZIP compression is lossless

Lossless compression means the original information can be reconstructed exactly when the archive is decompressed.

Original file ↓ Compress ↓ ZIP data ↓ Extract ↓ Original file restored

No content needs to be deliberately discarded. This is different from lossy formats that may remove information to achieve smaller file sizes.

// file size

Not every file becomes much smaller

Text-based files often compress very effectively because they can contain repeated patterns.

TXT CSV XML HTML JSON

Files that are already compressed may shrink very little.

JPEG MP3 MP4 PNG

In some cases, placing already compressed data inside a ZIP archive may produce almost no size reduction.

// storage

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.

ZIP archive │ ├── file1.txt → compressed ├── photo.jpg → stored └── video.mp4 → stored
// extraction

What does "extract" mean?

Extracting a ZIP file means taking files out of the archive and restoring them as ordinary files and folders.

project.zip ↓ Extract ↓ project/ ├── index.html ├── styles.css └── script.js

The ZIP archive itself can remain unchanged after extraction.

// creating

What does "zip" a folder mean?

To zip files means to package them inside a ZIP archive.

Folder ↓ Create ZIP archive ↓ folder.zip

Operating systems such as Windows and macOS include built-in tools for creating and extracting ZIP archives.

// internal structure

A ZIP file contains multiple file records

Internally, ZIP stores information about the files inside the archive.

This can include:

File Names Folder Paths Compressed Data File Sizes Checksums Timestamps
// directory

ZIP files contain a central directory

A ZIP archive normally contains a central directory describing the entries stored inside it.

ZIP archive │ ├── File data ├── File data ├── File data │ └── Central directory ├── file names ├── locations ├── sizes └── metadata

Software can use this information to find and list the archive's contents.

// integrity

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.

Stored checksum ↓ Extracted file ↓ Calculate checksum ↓ Compare values
// encryption

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.

// container format

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.

// xlsx example

An .xlsx file is a specialised ZIP package

workbook.xlsx ↓ ZIP package ↓ xl/ ├── workbook.xml ├── styles.xml └── worksheets/ └── sheet1.xml

This is why renaming a copy of an .xlsx file to .zip can allow ZIP software to inspect its internal structure.

// zip vs folder

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
// archive formats

ZIP is one of several archive formats

ZIP RAR 7Z TAR GZIP

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.

// programming

Software can create ZIP files automatically

Programming languages can create, inspect and extract ZIP archives.

Python PHP JavaScript Java C#
// python example

Python can create ZIP archives

import zipfile with zipfile.ZipFile( "project.zip", "w", zipfile.ZIP_DEFLATED ) as archive: archive.write("index.html") archive.write("styles.css")

The program creates an archive and adds files to it.

// automation

ZIP files are useful in automated workflows

Generate files ↓ Create ZIP ↓ Upload archive ↓ Send to customer ↓ Customer extracts files

This makes ZIP useful for exports, backups, downloadable packages and batch processing.

// backups

ZIP files are commonly used for backups

A group of related files can be bundled into one archive:

website-backup.zip │ ├── html/ ├── css/ ├── images/ ├── scripts/ └── data/

This makes the collection easier to copy, store and transfer.

// transfer

ZIP files make collections easier to send

Instead of attaching twenty separate files to a message, they can be placed inside one archive.

20 files ↓ project.zip ↓ 1 attachment
// security

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.

// uses

What are ZIP files used for?

File Transfer Compression Backups Software Downloads Website Files Data Exports Document Packages Automation Archiving
// mental model

The simplest way to think about a ZIP file

Files + folders ↓ Package together ↓ Optional compression ↓ archive.zip ↓ Transfer or store ↓ Extract ↓ Original files + folders
// summary

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.

What Is Python?

// programming What Is Python ? Python is a high-level, general-purpose programmi...