ZIP Compressed Archive (.zip)

PKWARE 标准

ZIP is an archive file format that supports lossless data compression, allowing multiple files and directories to be packaged into a single transportable container.

将 ZIP 转换为 TAR

免费的浏览器端 ZIP 转 TAR 转换器。在您的设备上即时转换文件。

在线压缩 ZIP

100% 浏览器本地私密压缩 — 文件永不离开您的设备

检查与元数据

操作系统和文件分析器通过检查开头的二进制字节序列来识别 ZIP 文件:

选择或拖放文件

选择或将文件拖放到此处

100% 浏览器端私密转换 - 文件绝不会离开您的设备

或粘贴 Ctrl+V
零网络传输隐私保证: 上传至外部服务器的数据为 0 字节。所有处理均在您的浏览器沙箱中本地完成。

字节级文件头签名 (Magic Bytes)

操作系统和文件分析器通过检查开头的二进制字节序列来识别 ZIP 文件:

十六进制签名 (偏移量 0):

50 4B 03 04

ASCII 表示形式: PK..

标准化: PKWARE APPNOTE / ISO/IEC 21320-1

技术规格

容器架构Archive container combining multiple files with individual compression headers
压缩方式Deflate (Method 8), Store (Method 0), BZIP2, LZMA, Zstandard
字节序Little-Endian for all signature headers, CRC32 checks, and sizes
色彩空间Not applicable (binary container for arbitrary files)
通道与结构Hierarchical directory structures, metadata streams, and file checksums
最大尺寸Standard ZIP: 4 GB / 65,535 files; ZIP64: 16 Exabytes / 18 quintillion files
透明度Not applicable
流式传输与渐进式加载Central directory at end of file enables instant listing without decompressing

技术对比矩阵:ZIP 对比同类产品

技术属性ZIP (当前)7-Zip (7z)TAR.GZRAR
Universal OS Compatibility100% native in Windows, macOS, Linux, iOS, AndroidRequires 7-Zip or third-party appNative in Linux/macOS; requires tool in WindowsRequires WinRAR or unrar library
Compression EfficiencyModerate (Deflate algorithm)Very high (LZMA/LZMA2 algorithm)Moderate (Deflate over tar)High (RAR proprietary compression)
Solid ArchivingNo (each file compressed independently)Yes (solid blocks boost compression for duplicate text)Yes (compresses entire tarball)Yes (optional solid mode)
Selective ExtractionFast instant extraction of any single fileRequires decompressing preceding solid blocksMust decompress stream up to target fileFast if non-solid

常见损坏模式与十六进制恢复指南

⚠️ Archive utility reports 'End-of-central-directory signature not found' or invalid archive.

根本原因: Truncated download missing the final bytes containing the Central Directory record.

恢复方法: Use 'zip -FF damaged.zip --out fixed.zip' to scan local file headers from the beginning and reconstruct a new central directory.

安全分析与解析器攻击向量

ZIP security centers on Zip Slip path traversal vulnerabilities and decompression bombs.

已知攻击向量

  • Zip Slip: Malicious filenames containing '../../' path traversal escaping the target extraction directory.
  • Zip Bomb: Tiny archives that expand into petabytes of zeros (e.g. 42.zip 42 KB expanding to 4.5 PB), crashing servers through disk and memory exhaustion.
  • Legacy ZipCrypto encryption vulnerabilities allowing ciphertext-only key recovery in minutes.

防御性最佳实践: Always sanitize extraction file paths to ensure they stay within the target folder. Set strict max byte and file count limits when unzipping untrusted uploads. Use WinZip AES-256 encryption.

历史渊源与里程碑

2015ISO/IEC 21320-1 formalizes ZIP as the baseline container for EPUB, DOCX, and JAR files.
1998Microsoft Windows integrates native ZIP folder extraction in Windows 98 Plus!.
1989Created by Phil Katz for PKZIP following a legal battle with SEA over ARC.

核心优势与特点

  • Universally supported by every operating system on earth without installing third-party software.
  • Central directory located at the end of the archive allows instant file listing without decompressing.
  • Individual files can be extracted selectively without decompressing the entire archive.

技术局限与劣势

  • Does not store UNIX file permissions or symlinks reliably across platforms.
  • Non-solid archiving means compression ratio is lower than 7z or tar.xz for large collections of similar files.
  • Standard legacy ZipCrypto encryption is cryptographically broken (AES-256 is required).

趣味技术冷知识

  • The 'PK' in the ZIP file header stands for Phil Katz, the inventor of PKZIP.
  • Almost all modern app formats (Android .apk, Java .jar, Office .docx, e-books .epub) are actually ZIP archives.

常见技术问题

What is the difference between ZIP and 7Z?

ZIP is universally compatible with every operating system without installing extra software. 7Z uses the modern LZMA/LZMA2 algorithm with solid compression, achieving 30%–50% higher compression ratios but requiring third-party software to open on older systems.

Why is it fast to view the contents of a ZIP file?

ZIP stores a 'Central Directory' at the very end of the file. Software simply reads the last few kilobytes to immediately display the full directory tree and file names without decompressing any files.