How to Create an Encrypted Disk Image in OS X

Looking for a way to encrypt a folder of sensitive data on your Mac? You could encrypt your entire hard drive using File Vault, but this may be overkill for most people. Luckily, OS X has a built-in feature that allows you to create an encrypted disk image containing whatever data you want inside the image.

The only way to open the disk image is to enter the password. You can copy the disk image like a normal file and it will be unreadable unless unlocked on a Mac. Overall, it’s like creating your own encrypted file container.

Also, be sure to check out my article on how to securely encrypt a USB flash drive, which is another good way of storing sensitive data.

Create Encrypted Disk Image

To create the disk image (DMG) on your Mac, first create a folder that includes all the data you want to encrypt. Note that once you create the disk image, the original unencrypted folder will still remain on your system and you should delete it immediately.

To get started, go ahead and open Disk Utility by going to Applications or by clicking on the Spotlight icon (magnifying glass) at the top right and typing in Disk Utility.

spotlight disk utility

Once Disk Utility is open, go ahead and click on FileNew Image Image from Folder.

image from folder

You’ll now have to choose the folder that you would like to encrypt as a disk image.

choose folder to encrypt

Click Open and you’ll get the Save As dialog where you have to give your new image a name and choose from a couple of options.

save image dialog

By default, it’ll save the new disk image in the same folder that you are encrypting. Under Encryption, you can choose from 128-bit or 256-bit AES encryption. The latter will be slower because of the stronger encryption, but your data will be better protected. When you choose any of the encryption options, you’ll be asked to enter a password.

256 bit aes encryption

Make sure you enter a very long and strong password because this is the only security that protects your data. If a hacker gets a hold of your file, they can try to use a brute-force attack to determine the password. Anything over 12 characters with letters, numbers and symbols will take a very long time to crack even on a really fast computer or cluster of computers.

For Image Format, you can choose from read-only, compressed, read/write, DVD/CD master or hybrid image. For our purposes, you should choose either read-only or read/write. If you choose the latter option, you’ll be able to add more files/folders to your encrypted image at a later point.

Click Save and your new image will be created. Note that if you chose 256-bit AES encryption, it could take quite a while for your disk image to be created.

creating disk image

Now when you go to open the image file, you’ll get a prompt asking for the password. Make sure you do NOT check the Remember password in my keychain box.

enter image password

If you enter the password correctly, the image will be mounted like a drive and if you chose read/write for the Image Format, then you can add or remove items from the encrypted image just like a normal drive. When you add something to the drive, it will automatically be encrypted and protected.

mounted encrypted image

Create Blank Encrypted Image

It’s also worth noting that you don’t have to necessarily create an encrypted image from a folder. You could also open Disk Utility and then click on FileNew ImageBlank Image.

new blank image

Here you will see a couple of more options. Firstly, you can specify the size of the disk image and the file system format. It’s recommended you stick with OS X Extended (Journaled) so that all security features are supported.

For Partitions, you can choose from Single partition – GUID Partition Map or Single partition – Apple Partition Map. All of the other settings are the same as previously mentioned.

Overall, it’s a great way to secure data on your Mac from prying eyes without having to install any third-party software or enabling File Vault on your entire system. If you have any questions, feel free to comment. Enjoy!