Warning icon
MacPaw stands with Ukraine. Here’s how you can help our country win with just several clicks.

The best ways to password protect a ZIP file on Mac

6 min read

We often compress or ZIP files on Mac to save space, but we should also take more care in what we're storing. Chances are you're compressing files that hold sensitive information. Zipping files is a great method for making the data inside more difficult to access, but that compression doesn't prevent prying eyes from taking a look.

We'll show you how to password protect a ZIP file, open encrypted ZIP files and folders, and discuss some proven methods for safeguarding your data.

How to password protect a ZIP file with Terminal

There's a simple way to zip and password protect folders and files via Terminal. It takes some unique commands, but it's the most straightforward method to password protect ZIP file and folders on Mac. Here's how it's done:

  1. Open Terminal on your Mac
  2. Type in 'cd' (no parentheses) and the location of the file or folder you want to compress and protect
    Note: if your file or folder were saved to the desktop, you'd type in: cd desktop
  3. Type this command into Terminal: zip -er filename.zip
    Note: in the image below, our folder is named 'Setapp' so the command reads: zip -er setapp.zip
  4. Enter and verify a password

Protect archives with password via Terminal

That's all it takes! You'll now see a compressed file on your desktop. Double-clicking the file or folder to open it will prompt you for the password you typed into Terminal, so be sure to keep your passwords in a safe location.

Are there any other alternatives?

Terminal is a great option for zipping and encrypting one file or folder, but it's not great for multiple compressions. You can enter multiple filenames or folder names after the 'zip -er' command, but an errant keystroke or mistyped filename will render the process useless. 

An app that can handle compression and encryption is a better bet for most users – especially when it can handle drag-and-drop or has a window that shows your entire filesystem. 

The better way to protect ZIP files on your Mac

BetterZip for Mac is – well, better! It has a clean, easy to understand interface that helps you discover files and folders easily, then compress and password protect them quickly. You can archive files you need to tuck away for safekeeping, and BetterZip works with popular compression formats like RAR, ZIP, 7-ZIP, and ISO. It automatically protects your files and folders with AES-256 encryption, and has a password generator for creating and managing secure passwords for files or folders.

Encrypt zip files with BetterZip app

BetterZip works via a structure it appropriately calls archives, which are projects for compressing and encrypting backups of your files and folders. You can add as many files or folders to an archive as you like, and choose where you'd like your archive saved after it's compressed. 

Where BetterZip stands apart is it allows you the option to edit files within an archive. If the app detects you actually made any changes to a document, it offers you the option to update (re-compress) your archive. You can also search within archives.

When it comes to encryption, BetterZip is also better than the alternatives for compressed files. When you create passwords for zipped files archived in BetterZip, it saves those passwords for you in its password manager. When you attempt to open an encrypted file or folder in betterZip, it will attempt to use the saved passwords in its password manager. This helps you create secure passwords others can't possibly guess, but also helps make it easy to edit or view files as you won't have to remember passwords or deal with external password managers.

You can also opt to enter passwords manually if you don't want the app to try each password when opening a file, and the password manager is available for you to edit if you like.

Create encrypted archives in seconds

If you need to compress and encrypt files quickly, Archiver might be just what you're looking for.

Archiver has a really clean drag and drop interface that allows you to drag any file or folder onto its app window, then press a single button to create a zipped archive of your documents. It also supports compressing multiple files or folders, and will compress them individually in a batch process.

While compressing files definitely saves you space, Archiver also encrypts and password protects files. Here's how it's done:

  1. Open Archiver on your Mac
  2. Drag a file or folder onto the Archiver app window
  3. Select "Archive" at the bottom of the window
  4. Select the type of zipped file you'd like to create
  5. Check the box next to "Encrypt"
  6. Enter and verify your password for the zipped file
  7. Select "Archive"

Enter a password in Archiver app

That's all it takes to create an encrypted, compressed file with Archiver.

How to open a password protected file

There are a few key ways to open a password protected file on your Mac. If you know the password and just need to view a file, double-clicking it and entering the password will open the file up and uncompress it.

You could also use Terminal to do this. Here's how it's done:

  1. Open Terminal on your Mac
  2. Use the 'cd' command noted above to change the directory to where your zipped file is located
  3. Enter this command into Terminal: unzip -P (password) -d (destination folder)
    Note: You will need to replace (password) with the password for the encrypted file, and (destination folder) should be the folder your file is saved. Do not use parentheses.
  4. Press enter

Open password protected zip file with Terminal

Double-clicking a folder or file and Terminal are both destructive to your compression, meaning the encrypted file is unzipped after you open it. BetterZip doesn't disturb your folder or file's compression. The app allows you to view and edit files within a zipped folder or zipped files themselves. So long as you use BetterZip, you can perform many functions without disturbing the compression, and the app has a 'save' feature if you do edit documents.

Here's how it works:

  1. Open BetterZip on your Mac
  2. In the BetterZip window, select the zipped file you want to view or edit
  3. If you're viewing files, simply double click the file in the compressed folder to view
  4. If you are making edits, like changing the filename, make any edits you like
  5. If edits were made, simply select "Save" at the top left of the BetterZip window to re-save the compressed file or folder

Re-save the compressed file or folder


Zipping and encrypting files or folders on your Mac is important. It's one of the best way to safeguard important documents you won't need to access often, and sensitive personal information that can be tucked away on an external drive. Photos, tax documents, personal files, and other such items are perfect candidates for encryption on Mac.

Archiver and BetterZip are two great apps that do a sensational job of encrypting and compressing files in a wide array of formats. Power users may find BetterZip's ease of use for accessing zipped files very attractive, while others may appreciate Archiver's drag and drop interface and simplicity.

Either way, we think these apps are far better options than Terminal, which is fussy and linear. One wrong keystroke in Terminal can cause issues, so it's better to have a visual interface via an app when dealing with sensitive files or folders.

Both BetterZip and Archiver are available for free during a seven day trial of Setapp, the world's most prolific suite of productivity apps for the Mac. In addition to these two great apps, you'll gain unlimited access to the entire Setapp catalog of nearly 200 amazing native Mac apps. 

When the trial ends, Setapp is only $9.99 per month. It's an incredible bargain we think you'll love, so give Setapp a try today!

Get 240+ Mac apps for any job

Sign up to Setapp and try them for free.