Zip vs Tar.gz Files Explained and Compared (Archiving and the DEFLATE algorithm)
Tony Tascioglu (TechnoTony)
View ChannelAbout
No channel description available.
Latest Posts
Video Description
In this video, I explain the similarities and differences between two popular compressed archive formats, zip on Windows, and tar.gz in the *nix world. Both formats typically use the same compression, and also serve as a way to collect files together in an archive, however, there are a some fundamental differences between how they work and why they're used for different purposes. I discuss the two main steps of compression and linearizing the files into an archive, and how each stage differs between the two formats, as well as the advantages and disadvantages of each implementation. I hope you enjoy the video and learn something new! This is yet another video that is a bit rambly at times (having cut it down from over 30 minutes). I have added timestamps so you can easily skip between the sections you're interested in. I apologize in advance for the clipped (and heavily compressed) audio, this was recorded accidentally with a 10 dB boost on the mic, on a 128K MP3 recorder making for a questionable combination. ## Timestamps ### Introduction 00:00 - Introduction 00:19 - What is a zip and tar file? 01:45 - Gzip (and other compressors) 02:45 - Why use tar instead of zip on Linux? ### What's the difference? 03:48 - How does tar work? 04:39 - How does zip work? ### Comparison 05:09 - The advantages of zip 06:46 - The advantage of tar.gz (and streaming compression) 08:30 - The disadvantage of tar ### Further learning 09:30 - Notes on 7zip and .gz.tar 10:40 - Indexed tar files with pixz (and comparison to 7z) 13:30 - What should you use? 15:10 - Conclusion ## Links (Get Smarter Section) DEFLATE algorithm: Wiki: https://en.wikipedia.org/wiki/Deflate How DEFLATE works (good summary): https://zlib.net/feldspar.html Full specification: https://datatracker.ietf.org/doc/html/rfc1951 TAR format: Wiki: https://en.wikipedia.org/wiki/Tar_(computing) Man page: https://linux.die.net/man/1/tar Tar format specs: https://www.gnu.org/software/tar/manual/html_node/Standard.html Gzip: (based on DEFLATE) Wiki: https://en.wikipedia.org/wiki/Gzip Homepage: https://www.gnu.org/software/gzip/ Bzip2: Wiki: https://en.wikipedia.org/wiki/Bzip2 Homepage: https://www.sourceware.org/bzip2/ XZ utils: (LZMA2 compression) Wiki: https://en.wikipedia.org/wiki/XZ_Utils Homepage: https://tukaani.org/xz/ pixz: (parallel indexed xz) https://github.com/vasi/pixz pigz: (parallel implementation of gz) https://github.com/madler/pigz Lzip: (also based on LZMA2) Homepage: https://www.nongnu.org/lzip/ LZMA2 Compression: Wiki: https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm Z-Standard Compression: (aka zstd) Wiki: https://en.wikipedia.org/wiki/Zstd Homepage: https://facebook.github.io/zstd/ Source: https://github.com/facebook/zstd 7zip: (also generally LZMA) Wiki: https://en.wikipedia.org/wiki/7-Zip Homepage: https://www.7-zip.org/ Source code: https://sourceforge.net/projects/sevenzip/ p7zip (POSIX port): http://p7zip.sourceforge.net/ Zip: (generally DEFLATE) Wiki: https://en.wikipedia.org/wiki/ZIP_(file_format) Specs: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT Dar: (competing new format for tar) http://dar.linux.free.fr/ ## Content used: Zip and Tar icons in thumbnail from FlatIcon. Ending music is We'll Meet Again by TheFatRat ## Clarifications and Corrections Just to clarify a few things before I get some comments: The 'only decompress the file' benefit I mentioned in zip is because zip (and 7z) keep an index at the front. If you did .gz.tar, you wouldn't get that benefit, as tar isn't indexed. Next, when I say 'the index of the tar file is at the end', what I mean is that if you want the file list (like an index would produce), you need to read the archive to the end as though there is an index there (tar files don't have an index, just a few bytes at the front of each file). So, to get a file list, you need to read those bytes at the start of each file, meaning you have to read the full archive. I hope this clarifies it. Clarification: pigz is not indexed, pixz is. Pixz is backwards compatible with xz, although both support multithreading these days. (more to be added)
DIY Lava Lamp Necessities
AI-recommended products based on this video

Wellova DMSO 99.9% Pharmaceutical Grade with 99.9% Purity & Low Odor - 4oz (Dimethyl Sulfoxide) Clear Glass Bottle with Dropper
![[3 Pack] UniqueMe Screen Protector Compatible for Samsung Galaxy S25 Ultra Tempered Glass HD Clear Screen Protector with Easy Installation Frame, 9H Hardness Anti Scratch Bubble Free](https://m.media-amazon.com/images/I/61ozaJGgNWL._AC_UL960_FMwebp_QL65_.jpg)
[3 Pack] UniqueMe Screen Protector Compatible for Samsung Galaxy S25 Ultra Tempered Glass HD Clear Screen Protector with Easy Installation Frame, 9H Hardness Anti Scratch Bubble Free
![[2-Pack] Lmcpa Screen Protector for Nintendo New Switch 2(2025)7.9 Inch, Anti-Scratch, Bubble-Free, Transparent HD Clear Tempered Glass Film Screen Protector, 9H Hardness, Ultra-Thin 0.25mm, Accessories for Switch 2](https://m.media-amazon.com/images/I/71qCF0ptL9L._AC_UL960_FMwebp_QL65_.jpg)
[2-Pack] Lmcpa Screen Protector for Nintendo New Switch 2(2025)7.9 Inch, Anti-Scratch, Bubble-Free, Transparent HD Clear Tempered Glass Film Screen Protector, 9H Hardness, Ultra-Thin 0.25mm, Accessories for Switch 2

JETech Full Coverage Screen Protector for iPhone 16e 2025, iPhone 14 6.1-Inch, 9H Tempered Glass Film Case-Friendly, HD Clear, 3-Pack

Spigen Case for iPhone 16 Plus Case, Liquid Crystal Glitter Designed for Apple iPhone 16 Plus - Crystal Quartz

LITTLEFUN Decorate Your Own Baseball Cap with Glitter Gem Stickers for Kids Crafts Toys Gifts - Girls Birthday Presents

Furiet for Samsung Galaxy S24/S25 5G Floral Wallet Case with Flip Zipper Purse Wrist Strap Shoulder Strap Luxury Glitter PU Leather Card Holder Stand Phone Cover for S 24 24S 25 25S G5 Women Purple

Generic Jelly Shoes for Girls, Kid Fishermen Sandals, Princess Birthday Toddler Glitter Sandal Summer Beach Shoe Footwear

HATALKIN Case Compatible with Apple AirTags Case Keychain Air tag Holder Air Tag Key Ring Cases Air Tags Protective Cover Airtag Key Chain Loop Holders Silicone for Luggage Dog Cat Pet Collar 4 Pack

Silicone Scar Cream Gel for Scars: Medical Grade Silicone for Old and New Scars

L00KLY Kids Case for Lenovo Tab M11 2024 With Screen Protector, Built-in Kickstand and Handle - Lightweight Shockproof Silicone for 11 Inch Tablet (TB330FU) Blue

Anti Snoring Devices for Quiet Sleep: Adjustable Mouth Guard for Sleep - Silicone Snore Stopper for Men Women Home & Travel Use (1 Pack)

High Accuracy and LCD Digital Clear Display Non-Contact Photoelectric Velocimeter Mini RPM Tester Meter for Motor, Wheels, Lathe, Electrical Fan, Paper Making, Plastic Industry, Washing Machines

MBLABEL 350 Bags/Roll - 30x50cm(12x20in) Clear Plastic Bags for Groceries, Transparent Produce Bag for Fruits Vegetable Kitchen Food Storage, Small Reusable Poly Packing Bags

KMEOSCH Rubber Earring Backs For Studs, KMEOSCH Hypoallergenic Soft Plastic Pierce Clear Silicone Secure Earring Backs For Posts Fish Hook Wire Earrings (12Pcs Gold)

EooCoo Compatible with MacBook Air 15 inch Case 2025 2024 2023 Release M4 A3241 M3 A3114 M2 A2941 Liquid Retina Display, Plastic Hard Shell Case + Keyboard Cover + Screen Protector, Crystal Clear Global Recycled Standard

Paint Your Own Moon Lamp Kit, DIY 3D Moon Night Light with Space Figurines & Wooden Stand, Art Supplies Creativity Arts & Crafts Kit for Kids, Toys Girls Boy Birthday Easter Gift Ages 3 4 5 6 7 8 9 10 11 12+

Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

Windshield Crack Repair kit Windshield Repair kit, Glass Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit 2 Pack (Drakgray)

