A zip file is a single file that holds one or more other files, each compressed and packed end to end, followed by a central directory that lists every entry in the archive. That directory sits at the end of the file so software can find it instantly without reading the whole archive, which is why zips open fast even when they are large.

In short: a .zip is a container of compressed files plus a table of contents, wrapped in a header, records and a footer. Knowing those parts explains almost everything else you might notice: why a zip cannot be partially edited, why a password sometimes protects only the contents, and why a damaged download can fail to open even when most of it arrived.

The three layers inside every zip: local records, the central directory, and the end record

A zip archive is built in three layers, and each layer does a different job.

The first layer is a series of local file records. Each file you add gets an entry at the start of its own data: a small header with the file name, its size, its compressed size, a timestamp, and the compression method used. The file's actual bytes follow, either stored as-is or compressed, and then comes a short data descriptor if the sizes were not known when the header was written. These records are stacked one after another, so a zip containing 40 files has 40 of them.

The second layer is the central directory. Once every file is written, the archiving software goes back and writes a compact list of all the entries: names, sizes, offsets, checksums and attributes gathered in one place. This is the archive's table of contents.

The third layer is the end-of-central-directory record, a fixed block at the very end of the file that says where the central directory starts and how many entries it contains. Software reads this footer first, jumps to the central directory, and builds its file list from there. Only when you open a specific file does it jump to that file's local record and decompress it.

That design has a practical consequence: to list contents, a program needs only the tail of the file. To extract one file, it needs the tail and that one record. It does not need to scan the whole archive.

What compression and checksums do to the bytes

Every entry is compressed independently, using one method chosen per file. Two methods cover almost all everyday zips. Storing, also called no compression, keeps the bytes exactly as they were and is used for files that are already compressed, such as JPEG photos, MP4 video or PDFs with embedded images. Deflate is the classic general-purpose method and typically shrinks text, code, spreadsheets and word-processing documents well, often to a fraction of their original size, though the exact saving depends on the content. Some tools also offer stronger methods for large archives.

Each entry carries a CRC-32 checksum, a short numeric fingerprint of the uncompressed data. When extraction finishes, the software recomputes the checksum and compares. If they differ, it warns you that the file is corrupted, which is why a single flipped bit in transit can produce an error on one file rather than a silently broken result. A CRC is a corruption check, not a security check: it catches accidental damage, not deliberate tampering.

The header also records the compression method, the uncompressed size, the compressed size, the date and time of last modification, and a general-purpose bit field whose flags tell the reader whether the entry is encrypted, whether sizes live in a data descriptor, and whether the name is UTF-8 encoded.

Why a file can appear twice in the listing

A zip may legally contain two entries with the same name. The central directory lists both, and most extractors quietly overwrite the earlier one with the later one. This is normal in archives that were updated incrementally rather than rebuilt from scratch, and it is one reason a zip's internal file names are not guaranteed unique. If you need a clean archive, extract everything and create a fresh zip rather than adding files repeatedly to an old one.

Single files versus split, spanned and zip64 archives

The basic anatomy holds across the zip family, but a few variants add extra structure. The table below shows what changes.

VariantWhat it looks likeWhat changes in the anatomy
Standard zipOne file ending in .zipLocal records, central directory, end record
Split archiveSeveral parts, often .z01, .z02, .zipEntry data is cut across parts; the central directory is usually in the last part
Zip64Ordinary .zip nameAdds extended records so entries and archives can exceed the classic size and count limits
Self-extractingAn .exe wrapperA small program is prepended before the zip data

Split archives matter because the parts are useless separately. If one piece is missing or renamed, extraction fails even though the other parts are intact. Rename a part and the reader cannot follow the chain, so keep the original names and keep every part in the same folder. Zip64 exists because the original format used 32-bit fields for sizes and offsets; archives that push past those limits need the extended records, and most current tools handle this automatically. A self-extracting archive is just a zip with a launcher in front, which is why antivirus software treats an emailed .exe with suspicion even when the payload is harmless.

Password-protected zips and where the encryption sits

Encryption is applied per entry, inside the local record, not around the whole file. Two schemes are common: the older ZipCrypto scheme, and stronger AES-based encryption supported by many modern tools. With ZipCrypto the file names and the directory remain readable, so anyone can list the contents even without the password; only the data is scrambled. This is one reason a password on a zip is not the same as a locked box.

With stronger encryption the names and contents in that entry are protected, but the surrounding structure is still a zip. The practical rule is that a password protects entry contents, not the existence or names of files, unless the tool encrypts the headers too. Never store the only copy of critical data in a password-protected zip without recording the password elsewhere, because there is no recovery path built into the format.

Why zip files fail to open, and how to check the damage

Most failures trace back to the three layers. A truncated download loses the end record and the central directory, so the software cannot find the table of contents even though most file data is present. A file that opens but reports a checksum error on one entry has a damaged record, usually from a bad transfer. A zip that opens but shows odd characters in file names was likely written with a different character encoding than the extracting tool expects.

The first check is size: compare the archive's byte size with what the source reported. The second is to try listing contents without extracting, since listing reads only the central directory. If listing works but extraction fails, the problem sits in one entry's data. If listing fails, the footer or directory is damaged, and a repair tool that rebuilds the central directory from the local records is the usual fix. Extract to a fresh folder rather than over an existing one, and check free disk space, because a full drive produces extraction errors that look like corruption.

For everyday use, the safe habit is to keep the original archive until you have confirmed every extracted file opens. Verify the largest and most important files first; they are the ones most likely to be cut short by a partial download.

When you open a zip, what a tool is really doing

Knowing the layers lets you predict the behaviour you see. Double-clicking a zip in a file manager usually reads the end record, shows the central directory as a folder view, and decompresses a single file only when you open it. That is why browsing a large zip feels fast but opening a big file inside can pause. Right-clicking and choosing an extract command typically unpacks every entry and checks each checksum, which is slower but safer. Dragging files out follows the same path as opening them individually.

If you are inspecting an unfamiliar archive before trusting it, list it first, look for unexpected executables or scripts, and extract only what you need. The anatomy gives you the parts to reason about: a header, compressed entries, a directory, a footer, and a checksum on each file. Once those are clear, zips stop being opaque and start behaving predictably.