How to Password Protect a Folder on Mac
macOS has no "set password" option for a plain folder. The built-in fix is an encrypted disk image: open Disk Utility, choose File > New Image > Image from Folder, pick 256-bit AES encryption, set a password and save. Double-click the .dmg file to open it with that password. Eject it to lock the contents again.
Steps use macOS 14 and later names. Menu wording can differ slightly between versions.
The built-in way: an encrypted disk image
A disk image is a file that behaves like a small drive. When you encrypt it, macOS asks for the password each time you open it. The folder's contents are AES-encrypted inside the file.
-
Keep a safe copy first
Copy the folder somewhere temporary. You will delete the original only after you have opened the encrypted version and checked it.
-
Open Disk Utility
Press ⌘Space, type Disk Utility and press Return. It also lives in Applications > Utilities.
-
Start the image
Choose File > New Image > Image from Folder…, select your folder and click Choose.
-
Set the encryption
Name the image and choose where to save it. In the Encryption menu pick 256-bit AES encryption. Enter a password twice and click Choose.
-
Pick a format
For a folder you will not change, read-only or compressed is fine. If you want to keep adding files, use the blank-image method below instead.
-
Save
Click Save. Disk Utility writes
YourFolder.dmg. -
Test it
Double-click the .dmg and enter the password. Do not tick "Remember password in my keychain", or the image will open without asking.
-
Remove the original
Delete the plain folder and empty the Trash. Read the Time Machine warning below before you rely on this.
If you want to keep adding files
Choose File > New Image > Blank Image… instead. Set a size, pick APFS as the format, choose 256-bit AES encryption, and set the image format to sparse bundle disk image, which grows as you add files. Open it, drag files in, and eject it when you finish.
The Terminal version
hdiutil create -encryption AES-256 -srcfolder ~/Documents/Private -format UDZO ~/Desktop/Private.dmg Other built-in options and where each one stops
| Method | Good for | Limit |
|---|---|---|
| Encrypted disk image | Any files or folders | You must eject it. While it is open, anyone at your keyboard can read it. |
| Locked note in Notes | Short text and some images | Apple says notes with videos, audio, PDFs or documents attached cannot be locked. Apple cannot recover a forgotten custom password. |
| Encrypted PDF in Preview | One PDF at a time | Open the PDF, then File > Export… and tick Encrypt. Works for PDFs only. |
| zip -er in Terminal | Nothing sensitive | The standard zip tool uses an old, weak encryption method. Use a disk image instead. |
| FileVault | A lost or stolen Mac | It protects the whole disk. After you log in, every file is readable by whoever sits at the Mac. |
Without Disk Utility
If you would rather not use Disk Utility, these also work, each for a narrower job:
- Terminal: the
hdiutilcommand above makes the same encrypted image with no windows. - A locked note for text and some images (see the table).
- An encrypted PDF from Preview for single documents.
- An app such as Cryptomator (open source) or, when it is released, a vault app with its own lock.
Where the built-in way falls short
- Old backups keep the plain folder. If Time Machine backed up the folder before you encrypted it, those backups still hold it unencrypted.
- A mounted image is an open image. The password is only checked when you open it. If you forget to eject, it stays readable.
- The file is visible. A .dmg named
Private.dmgtells anyone that something is hidden. - Mac may keep traces. Previews and recent-file lists can remember file names after you eject.
- No recovery. Forget the password and the data is gone. Apple cannot get it back.
The one-drag way with Hidden Folder
How it compares with each built-in option is on the Disk Utility comparison and the FileVault comparison.
Frequently asked questions
Can I right-click a folder and set a password on a Mac?
No. macOS has no password option in the Finder for a normal folder. Use an encrypted disk image, or an app.
Is a password-protected zip file safe?
The Terminal zip tool uses an old encryption scheme that is weak by modern standards. Prefer an encrypted disk image with 256-bit AES.
What happens if I forget the disk image password?
You lose the data. Apple has no way to recover it. Keep the password in a password manager or on paper.
Does FileVault password protect a folder?
No. FileVault encrypts your whole startup disk. It does not add a separate lock to a folder once you are logged in.
Can other users on my Mac see the .dmg file?
They can see the file exists if they can read the folder it sits in. They cannot read its contents without the password.
Will Time Machine back up the encrypted image?
Yes, as a file. Any older backup of the unencrypted folder stays in Time Machine until you delete it.
References
Your files. Your Mac. Locked.
Coming soon. Join the waitlist and we email the link.
Get early access