2 Best Ways to Encrypt Your Files and Folders in macOS

Last updated: June 14, 2024 Reading time: 8 minutes
How To Encrypt Folder In Mac

Many people use mac becasue of its robust privacy and security features. However, most of them face difficulty in encrypting a file or folder on mac. Don’t worry in this guide we will guide you how to do it using these two methods

  • Using terminal
  • Using utility disk

In addition, if you want to add an extra layer of protection and don’t want to get into this kind of techincal stuff, we recommend using a robust VPN like NordVPN. It will create an encryption tunnel and route your data through it, providing privacy and security.

Your Mac might be one of the most secure and personal devices you have, containing a ton of personal information. But are you content with the “Mac privacy and security” that Apple boasts about? Is it a risk you’re willing to take with your sensitive information?

What is there to say that Mac security won’t fail and your data will remain secure? Well, you can either contemplate the risks involved or take matters seriously into your own hands by encrypting your files on Mac. This article contains some of the best practices and tools you can opt for to encrypt files and folders on Mac, so if you’re interested in staying secure, read along.

Encrypt files and folders in macOS – Detailed guide

macOS is the most privacy-oriented operating system with dedicated privacy and encryption tools. In macOS, you don’t need third-party tools or software to encrypt files or folders. The two most popular ways you can encrypt files and folders in your Mac are as follows:

  • Using Terminal  
  • Using Disk Utility

These two methods are the best-known ways to encrypt files and folders within your Mac. These versatile and user-friendly tools offer robust security to Mac users through secure encryption protocols.

1. Encryption through terminal

The terminal offers two types of encryption to your files and folders: the AES-CBE-128 bit encryption or the AES-CBE-256 bit encryption ciphers. AES encryption is the industry-standard encryption cipher and one of the most robust encryption ciphers currently available. Additionally, Terminal uses the SSL encryption protocol to encrypt your files.

In the following demonstration, I will use 256 bits to encrypt the file; you can choose its alternative.

Terminal Command:

openssl enc -aes-256-cbc -e -in {from path} -out {desire location}


openssl enc {using OpenSSL encryption protocol}
-aes-256-cbc {Encryption level of 256 bit}
-e : {Encrypt}
-in: {file location path}
  1. Open >Terminal from Launchpad or applications
  2. Here is the code to encrypt openssl enc -aes-256-cbc -e -in
  3. In my case, I have created a text file named “information” on the desktop and put some information in it. It should look like this /Users/macbook/Desktop/information.rtf  
  4. Add [-out /Users/macbook/Desktop/encrypted.txt ] in this; I declared the location where it should be saved, the name of the file, and the image format of the file will be. Hit Enter
  5. Set the password> It will not show anything when you are typing, so enter the password and confirm the recovery key.
  6. File is been created on our desktop by named “ecnrypted.txt”
  7. It will open with a chipper text format; you cannot be able to read it, it will look like this.

Here is my complete command after everything

openssl enc -aes-256-cbc -e -in /Users/macbook/Desktop/information.rtf -out /Users/macbook/Desktop/encrypted.txt

Decrypt through terminal

It’s effortless to decrypt the file and folder as long as you remember the password; otherwise, there is no way you can ever decrypt it. As mentioned above, the AES encryption cipher is the strongest cipher that is not vulnerable to brute-force attacks. 

Breaking an AES encryption file is nearly impossible, so remember your password if you don’t want to lose your data forever.  A supercomputer would take 1 billion years to decrypt the AES 128-bit file. 

Along with your password, to decrypt your files on Mac, you will need to tweak the original code a bit, such as follows:

  1. Open> Terminal
  2. openssl enc -aes-256-cbc -d -in Just change -e to -d  means “d=decrypt” 
  3. Here is the complete command in my case openssl enc -aes-256-cbc -d -in /Users/macbook/Desktop/encrypted.txt -out /Users/macbook/Desktop/decrypted.rtf
  4. Enter your password and hit Enter

2. Encrypt file from disk utility

In the encrypt disk utility option, you may be unable to pick a particular file to encrypt. You need to make a folder, put everything in it, and then encrypt with AES 128-bit or AES 256-bit encryption ciphers. As mentioned above, both of these ciphers are impossible to decrypt. However, 128-bit is slightly faster to encrypt and decrypt.

  1. Open>Disk Utility
  2. >File>New Image>Image from Folder
  3. Select the folder, in my case, its “personal” folder on the Desktop, then Click on Choose
  4. Rename the document; I call it “encrypted,” then choose the encryption type you want to use from the bottom. I’m going with 256-bit AES encryption and hitting Save
  5. Next, you need to enter your password to encrypt it
  6. It will take time to complete, depending on size of the file
  7. After compilation, your folder will look like this; it’s an image for your folder.

This is how you can Encrypt the whole folder In macOS using encrypt Disk Utility. Just put your password and decrypt the drive, the encrypted image will stay as it is, but it will create another folder on the same spot. You can download stuff from it and put it in others. But the encrypted image will contain the same thing you put in the first place.


Encrypting your files on a Mac is a crucial step to attaining privacy and security. With hackers and data snoopers prowling to harm your data, it is best to maintain the utmost privacy and secrecy that you can achieve.

If you do everything correctly, your files and folders will be encrypted!


You can choose both options discussed above, whether using the Disk Utility option or the Terminal. You need to encrypt a file and attach it with an email to secure a transaction.
If you created the image through the Disk utility, the password is enough to open it. If you used Terminal to encrypt it, follow the steps above the “decrypt mac file” heading.
Whether you want to encrypt a folder is purely your choice. However, encryption offers much-needed protection from hackers and snoopers. After all, who wants anyone sneaking a peek into their data?
You can access all files from an encrypted image file by decrypting that folder to another, you can copy files from it, but you cannot add new files. If you want to add files to another encrypted folder, you need to delete that folder, create another one, put everything in that then again go through the encryption process from Disk Utility. 

Share this article

About the Author

Waqas is a cybersecurity journalist and writer who has a knack for writing technology and online privacy-focused articles. He strives to help achieve a secure online environment and is skilled in writing topics related to cybersecurity, AI, DevOps, Cloud security, and a lot more. As seen in: Computer.org, Nordic APIs, Infosecinstitute.com, Tripwire.com, and VentureBeat.

More from Iam Waqas

Related Posts