The Academy

Loading the search index…

Searches the academy on this device only.

ZIP files: compressing and extracting

Understand what a ZIP archive is, create and extract one on Ubuntu and Windows, and learn why some files shrink a lot and others hardly at all. You will also know the safety rules for opening ZIP files from other people.

25 minbeginnerUbuntu/LinuxWindowsPractical task needs a laptop or desktop

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

By the end of this lesson you will be able to

  • Explain what an archive is and what compression does.
  • Create a ZIP file from several files and extract it on Ubuntu and Windows.
  • Predict which kinds of file shrink well and which barely shrink.
  • Apply safety rules before opening a ZIP file from someone else.

Imagine posting twenty photographs to a friend as twenty separate envelopes. They could get lost, arrive in the wrong order or cost a lot. A ZIP file is the computer's way of putting them in one parcel, and it can often make the parcel smaller too. You will meet ZIP files when you download documents, receive photos and send work by email, so it is worth knowing how to make and open them with confidence.

An archive is a parcel of files

An Archive is a single file that contains other files and folders, together with the information needed to put them back exactly as they were. A ZIP file is the most common kind of archive. Its name usually ends in .zip. It has two useful effects. First, many files travel as one, which makes sending, downloading and storing easier. Second, the contents are usually compressed, so the parcel is smaller than the things inside.

Making a ZIP file does not change your original files. It creates a new file next to them. Taking things out again is called extracting (or unzipping). Extracting also leaves the ZIP file where it was, so you end up with two copies of the content: the packed one and the unpacked one. Delete the ZIP afterwards if you no longer need it.

Diagram

Compressing packs several files into one smaller file; extracting restores the originals.

  1. Step 1: Three filesNotes, Budget, Photo
  2. Step 2: CompressPack them up
  3. Step 3: Pack.zipOne smaller file
  4. Step 4: ExtractThree files again
Compressing packs several files into one smaller file; extracting restores the originals.
Read this figure as text

A flow showing three files being compressed into one ZIP file and then extracted back into three files.

A flow of four steps. Step one: three separate files, Notes.docx, Budget.xlsx and Photo.jpg. Step two: you choose Compress. Step three: one file, Pack.zip, which holds all three and is usually smaller. Step four: you choose Extract, and the three files appear again exactly as they were, in a new folder called Pack.

How compression works, and why photos barely shrink

Compression means storing the same information in fewer bytes. The idea is to find repetition and describe it briefly. If a text file contains the word invoice two hundred times, the compressor can store the word once and note 'repeat this two hundred times'. ZIP uses lossless compression: when you extract, every byte comes back exactly as it was, so nothing is damaged.

How much a file shrinks depends on how much repetition it contains. Plain text, spreadsheets and documents are full of patterns and often shrink by half or more. Files that are already compressed have little left to squeeze. A JPG photo, an MP3 song, an MP4 video and even another ZIP have been compressed when they were created. Zipping them saves very little, sometimes nothing at all.

Diagram

Illustrative sizes: text shrinks a lot, photos and video barely shrink.

Text file
about 30%
Spreadsheet
about 40%
Word document
about 60%
JPG photo
about 98%
MP4 video
about 99%

Size after zipping, as a percentage of the original. Illustrative values: real results vary.

Illustrative sizes: text shrinks a lot, photos and video barely shrink.
Read this figure as text

A bar chart comparing file sizes before and after zipping for a text file, a spreadsheet, a photo and a video.

A bar chart with illustrative sizes as percentages of the original, where 100 means no saving. A plain text file zips to about 30 percent of its original size. A word-processor document zips to about 60 percent. A spreadsheet zips to about 40 percent. A JPG photo stays about 98 percent. An MP4 video stays about 99 percent. The lesson is that text-like files shrink and already compressed media do not.

Creating and extracting ZIP files

Make and open a ZIP file

On Ubuntu 24.04 (Files)

  1. Step 1: Select the files

    Open Files and go to your practice folder. Click the first file, hold Ctrl and click the others to select several.

    You should see: The chosen files are highlighted.

  2. Step 2: Compress

    Right-click one of the selected files and choose Compress. In the box, type a name such as practice-pack, choose .zip from the format list and click Create.

    You should see: A new file, practice-pack.zip, appears in the same folder.

  3. Step 3: Extract

    Right-click the ZIP file and choose Extract Here to unpack it into the current folder, or Extract To to choose a folder. Double-clicking the ZIP file shows what is inside without unpacking.

    You should see: The files appear, usually inside a new folder named after the ZIP file.

Simulated interface: not a real screenshot

A simulated file manager listing three files and the ZIP file made from them.

practice
Notes.txt2 KB
Budget.ods45 KB
Photo.jpg2.9 MB
practice-pack.zip2.8 MB
  1. Marker 1: Originals stay where they were
  2. Marker 2: The new ZIP file
  3. Marker 3: The photo is already compressed, so the ZIP is barely smaller
A simulated file manager listing three files and the ZIP file made from them.
Read this figure as text

A simulated file manager window listing three practice files and one ZIP file with markers explaining each.

A file manager window titled practice. Three files are listed: Notes.txt at 2 KB, Budget.ods at 45 KB, and Photo.jpg at 2.9 MB (marker 1, the original files). A fourth item is practice-pack.zip at 2.8 MB (marker 2). It is the new archive. It is hardly smaller than the originals added together, because the photo is already compressed (marker 3). The originals are still present and unchanged.

Diagram

What extracting a ZIP file produces: a folder with the files inside.

  • practice
    • practice-pack.zipThe archive: stays after extracting
    • practice-packCreated by Extract
      • Notes.txt
      • Budget.ods
      • Photo.jpg
What extracting a ZIP file produces: a folder with the files inside.
Read this figure as text

A folder tree showing practice-pack.zip next to an extracted folder practice-pack that holds three files.

A tree with a folder called practice at the top. Inside it are four items. First, practice-pack.zip, the archive. Second, a folder called practice-pack, created when you extract, which contains Notes.txt, Budget.ods and Photo.jpg. The ZIP stays in place after extraction, so you can delete it once you are happy with the unpacked files.

Passwords and safety

Archives are a favourite hiding place for Malware, because a ZIP file can hold anything, including programs, and an email scanner cannot always look inside. Treat an unexpected ZIP file the way you treat an unexpected attachment: do not open it.

  • Know the sender. Only open a ZIP file you were expecting from someone you trust. If a message with a ZIP file seems odd even from a friend, ask them in another way.
  • Look before you extract. Open the ZIP in the file manager to see its contents list. Be wary of names ending in .exe, .scr, .bat or .js, which are programs or scripts.
  • A ZIP that asks you to enable macros or run something is a warning sign. Delete it.
  • Extract into a new folder. Never into the Desktop, where a pile of files will mix with your own.
  • Do not extract a ZIP file that is unusually huge for what it claims to be. A tiny download that expands into a huge amount of data is a known trick to fill a disk.

Common mistakes

  • ✖ Instead of: Opening a ZIP file from an unknown sender to see what it is.

    ✔ Do this: Do not open it. Delete it or report it. Open ZIP files only from people you know and were expecting.

  • ✖ Instead of: Working inside the ZIP file and then wondering where the edits went.

    ✔ Do this: Extract first, work on the extracted copy, and make a new ZIP if you need to send it.

  • ✖ Instead of: Trusting a ZIP password to protect very private files.

    ✔ Do this: Old ZIP passwords are weak. Use proper encryption tools for private material and send the password by another route.

If something goes wrong

The ZIP file will not open, or shows an error such as 'the archive is corrupt'.
The download or transfer may have been cut short. Download or copy the file again, then retry. If it still fails, ask the sender to make and send it again.
The extracted files are missing or I cannot find them.
Look for a new folder with the same name as the ZIP file in the same place. On Ubuntu, use Extract To and choose the folder yourself next time.
A ZIP file asks for a password I do not have.
Ask the person who sent it to give you the password by phone or another channel. Do not try to guess it or use programs that claim to break passwords.

Key terms

Archive
A single file that holds other files and folders packed together.
ZIP
A common file type that bundles files together and makes them smaller.
Compression
Making data take up less space by storing it more cleverly.
Lossless compression
Making a file smaller in a way that lets you get back the exact original.

Practise it for real

Reading is not the same as being able to do it. Complete these on your own computer, then tick only what you have actually done. These ticks are your own honest record: nothing checks them for you.

Guided exerciseNeeds a laptop or desktop

Make a ZIP, then extract it somewhere else

On your laptop, create a folder called practice and put in three small files: two text or document files and one photo. Select all three and create a ZIP file called practice-pack. Compare the size of the three originals with the size of the ZIP file. Then extract the ZIP into a new folder called unpacked and check that all three files are there and open correctly.

You have succeeded when:
Independent challenge

Challenge: judge four ZIP files

On paper, write one sentence for each of these cases saying what you would do and why. (1) A ZIP file called photos-wedding.zip from a cousin who said she would send it. (2) A ZIP file called invoice-paid.zip from an unknown sender. (3) A ZIP file that contains a file called setup.exe. (4) A ZIP file of 300 photographs that you want to send to Amina.

You have succeeded when:

Knowledge check

6 questions. You need 80% to pass. Mistakes here are part of learning, and you can retry as often as you like.

  1. Question 1.What is a ZIP file?
  2. Question 2.Zipping a JPG photograph will usually make it a lot smaller.
  3. Question 3.An email you did not expect says your parcel is delayed and has delivery-details.zip attached. The sender is a company you have never used.What should you do?
  4. Question 4.Match each term to its meaning.
  5. Question 5.After you make a ZIP file from three documents, what has happened to the three originals?
  6. Question 6.Put the steps for sharing three files as one ZIP file in the best order.
    1. Select the three files
    2. Attach or upload the ZIP file
    3. Choose Compress and name the ZIP file
    4. Check the ZIP file's size and that it opens

Summary

  • A ZIP file is an archive: one file that holds many, usually compressed.
  • Creating a ZIP leaves your originals untouched; extracting leaves the ZIP in place.
  • Lossless compression shrinks text and documents well but photos, music and video hardly at all.
  • Open ZIP files only from trusted, expected senders, and look at the contents list first.

Checklist: can you do these?

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

Related lessons

References and further reading

Official sources for details that can change between versions.

On this page