Convert TAR to GZ — Free Online Converter
Convert Tape Archive (.tar) to Gzip Compressed Archive (.gz) online for free. Fast, secure archive conversion with no watermarks or registration.
安全传输
HTTPS 加密上传
隐私优先
文件处理后自动删除
无需注册
即刻开始转换
随处可用
任何浏览器,任何设备
如何转换
Upload your .tar file by dragging it into the upload area or clicking to browse.
Choose your output settings. The default settings work great for most files.
Click Convert and download your .gz file when it's ready.
关于TAR转GZ
TAR bundles files and directories into a single uncompressed stream, preserving Unix metadata including permissions, ownership, and symlinks. GZ (Gzip) applies DEFLATE compression to a single data stream. The combination of TAR + GZ produces the ubiquitous .tar.gz format — the standard for source distribution on Unix/Linux systems.
Converting TAR to GZ compresses your uncompressed tar archive with gzip, producing the .tar.gz (or equivalently .tgz) format that every Unix system can extract natively. This is the most common archive compression operation in the Unix world — it takes a raw file bundle and makes it practical for storage and transfer.
为什么要将TAR转换为GZ?
Plain TAR files are impractically large for distribution and storage. A source code directory that unpacks to 100 MB as TAR typically compresses to 15-25 MB as .tar.gz. This 75-85% size reduction makes the archive practical for downloading, email attachment, and storage. Virtually every open-source project, Linux distribution, and Unix package system uses .tar.gz as their primary distribution format.
Gzip compression is the fastest standard compression option for tar archives, offering the best balance of speed and compression ratio for everyday use. While bzip2 and xz compress better, gzip decompression is significantly faster — a critical advantage when extracting on CI servers, embedded systems, or any time-sensitive pipeline.
常见使用场景
- Compressing raw tar archives for source code distribution and release packaging
- Reducing tar backup sizes for efficient storage on local drives or cloud platforms
- Creating .tar.gz packages expected by npm, pip, gem, and other package managers
- Preparing compressed deployment artifacts for CI/CD pipeline artifact storage
- Making tar archives practical for email attachment or web download distribution
工作原理
The TAR file is read as a continuous byte stream and piped through the gzip compressor. Gzip applies the DEFLATE algorithm (LZ77 + Huffman coding) with a 32 KB sliding window, processing the tar data sequentially. The output includes a gzip header (magic bytes 1f8b, compression method, timestamp, OS identifier), the DEFLATE-compressed data, and a trailer (CRC32 checksum of the original data plus original size modulo 2^32). Default compression level is 6 (balanced speed/ratio).
质量与性能
Entirely lossless. Gzip compression is mathematically reversible — `gunzip` perfectly reconstructs the original tar stream, verified by the CRC32 checksum. Every file within the tar archive is preserved exactly. The only change is the addition of gzip compression around the existing tar data — no file content is modified.
设备兼容性
| Device | TAR | GZ |
|---|---|---|
| Windows PC | Partial | Partial |
| macOS | Partial | Partial |
| iPhone/iPad | Partial | Partial |
| Android | Partial | Partial |
| Linux | Partial | Partial |
| Web Browser | No | No |
获得最佳效果的技巧
- 1Gzip level 6 (default) offers the best speed-to-compression ratio for most use cases — levels 7-9 rarely justify the additional CPU time
- 2For the fastest possible compression, use level 1 — useful for CI/CD where compression speed matters more than size
- 3The output .tar.gz can be renamed to .tgz if your target system prefers that extension — the content is identical
- 4Use `gzip -t file.tar.gz` to verify integrity after compression, especially before deleting the original .tar
- 5For better compression than gzip with reasonable speed, consider xz instead — it uses LZMA2 and produces significantly smaller archives
相关转换
TAR to GZ compression is the foundational operation of Unix archiving, producing the .tar.gz format used by millions of projects. Fast, universally supported, and lossless — it is the default choice for compressing tar archives.
TAR 与 GZ 对比
| 特性 | TAR | GZ |
|---|---|---|
| 全称 | Tape Archive | Gzip Compressed File |
| 扩展名 | .tar | .gz |
| 最适合 | Unix permissions | DEFLATE compression |