Forum Discussion

FlynnThorne's avatar
FlynnThorne
Iron Contributor
Apr 28, 2025

How to password protect a zip file in Windows 11?

I know how to create a zip archive in Windows 11 but I don't know how to add password to zip file as the files are quite sensitive and confidential.  What's the easiest way to password protect a zip file?

I tested the Windows 11 built-in ZIP compression tool but it doesn't support password protection, so do I need third-party software? If so, which free and reliable tools do you recommend?

Also, if there's a way to do it via Command Line or PowerShell, I'd like to try it out too.

Thanks in advance for your help!

14 Replies

  • JohnDobbins's avatar
    JohnDobbins
    Iron Contributor

    Windows 11’s built-in ZIP tool doesn’t support passwords. You’ll need a third-party app like 7-Zip (free and reliable) — it lets you create encrypted ZIP/7z files with AES-256. Alternatively, use PowerShell with the Compress-Archive cmdlet + an encryption module, but 7-Zip is by far the simplest and most secure option.

  • MasonHayes's avatar
    MasonHayes
    Iron Contributor

    You’re thinking about password protecting a zip file? Good move for keeping your stuff secure! But, like everything, there are a few downsides to consider before you lock it up. Based on my experience and some common issues folks run into, here’s the lowdown on the disadvantages:

    1. Password Management
    This is probably the biggest bummer: if you forget the password, it’s game over for getting into that zip file! I’ve personally lost track of passwords before, and it’s super frustrating. You could try some recovery tools, but who knows if they’ll work? So, write that password down or keep it in a password manager!

    2. Limited Compatibility
    If you use the AES-256 encryption (which is smart and recommended), it’s generally supported by most modern software like 7-Zip and WinRAR, but if a friend or colleague is using older or less common zip software, they might be stuck without being able to open your file. I’ve had a few awkward situations where I zipped a file for someone and they couldn’t get in because they were rocking some ancient software.

    3. Encrypting Filenames
    To password protecting a zip file. While AES-256 encrypts the contents of the zip, it won’t encrypt the filenames by default. That means anyone can see the names of your files even if they can’t access the contents. If you’re trying to keep everything super private, this can be a little annoying. I remember zipping some sensitive documents and realizing that, while they were secure, the names were still out there!

  • PatrickRoss's avatar
    PatrickRoss
    Iron Contributor

    There are vulnerabilities and limitations associated when you passwords protect a ZIP files, particularly in the context of Windows 11 and similar operating systems. Here are the main points to consider:

    Encryption Method Used

    • Weak Encryption Algorithms: Many ZIP file formats, especially those created using older software, use weak encryption methods (such as ZipCrypto) that can be easily cracked with modern computing power. Even though some tools support stronger algorithms like AES-256, not all ZIP utilities use this by default.
    • Password Strength: The security of a ZIP file is heavily dependent on the strength of the password used. Weak, easily guessable passwords can be compromised through brute force attacks.

     

    Vulnerabilities in ZIP File Protection
    Attackers can use various methods to crack ZIP passwords, including:

    • Trying all possible combinations of characters can succeed over time, especially if the password is weak.
      Dictionary Attacks: Using a list of common passwords can quickly reveal weak passwords that users frequently choose.
    • Traditional ZIP password protection typically does not include features like rate limiting (to slow down or prevent brute-force attempts) or account lockouts that are present in more robust security systems.
    • Not all ZIP utilities implement encryption correctly, leading to potential vulnerabilities. Following industry best practices when creating and sharing password protected a ZIP files is crucial.
    • Even with a password-protected ZIP file, metadata about the contents of the file (such as file names and sizes) may still be accessible without unzipping it, which can leak sensitive information.
  • Below is a powershell script you can use to password protect a zip in Windows 11 or Windows 10.

    # load the compression function
    Add-Type -AssemblyName System.IO.Compression.FileSystem
    
    # define path and password
    $sourcePath = "C:\path\to\your\file.txt" 
    $zipPath = "C:\output\encrypted.zip"
    $password = "YourPassword123" 
    
    #create new zip file
    $tempFolder = [System.IO.Path]::GetTempPath() + [Guid]::NewGuid().ToString()
    New-Item -ItemType Directory -Path $tempFolder -Force
    
    # copy new zip file to a tmp folder
    Copy-Item $sourcePath -Destination $tempFolder
    
    # add password to zip file
    [System.IO.Compression.ZipFile]::CreateFromDirectory($tempFolder, $zipPath)
    
    # delete tmp files
    Remove-Item $tempFolder -Recurse -Force

    Summary

    1. Simple requirements → Use Windows built-in tools (method 1).
    2. Strong encryption needs → use 7-Zip (method 2).
    3. Automated scripts → Create ZIP with PowerShell and encrypt it manually (Method 3 combined with Method 1/2).
    • CuriousTP's avatar
      CuriousTP
      Copper Contributor

      This doesn't seem to create a password protected zip file.

      • erkcan's avatar
        erkcan
        Copper Contributor

        Indeed, the code does not make use of the $password variable anywhere after it has been defined.

  • LucasTurner's avatar
    LucasTurner
    Iron Contributor

    Windows 11 built-in ZIP compression tools and most ZIP encryption tools support the following two encryption methods. You can use one of them to password protect a zip folder on Windows 11. Below are the details for the two encryption algorithms.

    ZipCrypto (traditional encryption)

    Algorithm: Symmetric encryption (old standard before AES became popular).

    Security: weak, vulnerable to known plaintext attacks (e.g. using WinRAR, 7-Zip, etc. to try to crack).

    Scenarios: High compatibility, suitable for older systems or simple encryption needs.

    AES-256 (recommended)

    Algorithm: Advanced Encryption Standard (256-bit key).

    Security: Currently the most secure ZIP encryption method, with strong resistance to brute-force cracking.

    Scenario: Supported by Windows 11 built-in ZIP tool, 7-Zip, WinRAR, etc. It is recommended to prioritize the use.

    Note: Windows 11 built-in ZIP encryption uses AES-256 by default, but filenames are not encrypted (you need to check “Encrypt filenames” with 7-Zip to enhance security).

    2. ZIP encryption precautions
    ✅ Security Recommendations

    Use a strong password: at least 12 digits with upper and lower case letters, numbers, symbols (e.g. P@ssw0rd!2024).

    Prefer AES-256: avoid ZipCrypto (easy to crack) to password protect a zip file.

    Encrypt filenames (if you need to hide them): with 7-Zip check -mhe=on (not supported by Windows built-in tools).

    ❌ Common Errors

    Forgot password after encryption → ZIP has no official way to retrieve it, make sure to keep it safe!

    Only compressed but not encrypted → You need to click the “Encrypt” button manually, otherwise the file is not protected.

    File name reveals information → File name is not encrypted by default (if sensitive, use 7-Zip instead).

     

  • EmersonGrove's avatar
    EmersonGrove
    Iron Contributor

    You can use online tools that allow you to password protect a Zip file files before compressing them into a ZIP file. Here are a couple of free and reliable options:

    1. ZipShere:

    - Click "Upload files" to upload your sensitive files.
    - After uploading, enter a password in the designated field.
    - Click "Create ZIP" to download your password protected a ZIP file.

    2. EnciiyptZip:

    - Upload the files you want to compress.
    - Enter a password to protect the ZIP file.
    - Click "Encrypt" and download the resulting password protected a ZIP file.

    Note: Be careful when using online tools to handle sensitive files, as they may store your data or expose it to risks.

    3. If you prefer using Command Line or PowerShel1, you can utilize 7-Zip from the command line:

    - Install 7-Zip: Ensure 7-Zip is installed. It is required for this method.
    - Open PowerShel1 or Command Prompt.
    - Navigate to the directory where your files are located using the cd command.
    - Run the following command:
    "C:\Program Files\7-Zip\7z.exe" a -pYourPassword -mhe=on output.zip file1.txt file2.txt
    Replace:
    YourPassword with the password you want to use.
    output.zip with the name you want for your zip file.
    file1.txt file2.txt with the actual names of the files you want to compress. You can use *.* to zip all files in the current directory.

  • EthanThomas's avatar
    EthanThomas
    Iron Contributor

    Here is some tricks for using the built-in tool to password protect a zip file in Windows 11.

    Add password to an existing zip file

    If you already have an unencrypted ZIP file, the follow the steps in below to add password to zip folder:

    1. Double click to open the ZIP file.
    2. Click "Home" → "Encrypt", enter the password and save.
    3. Close the ZIP window to take effect.

    Verify that the encryption was successful

    Double-click the encrypted ZIP file. If a pop-up message "Password required to extract file" appears, the encryption was successful.

    Cautions

    1. Problems with file name visibility: After password protecting a zip file by Windows built-in tools, the file names in ZIP are still visible (the contents of the files need a password to be extracted). If you want to hide the file name, you need to use 7-Zip and check "Encrypt file name".

    2. Forgotten password cannot be recovered: Microsoft does not provide a password recovery function, so be sure to memorize your password!

  • LucasWilson's avatar
    LucasWilson
    Iron Contributor

    Windows 11 has a built-in compression utility that is integrated into File Explorer, which allows you to quickly create and decompress ZIP files with AES-256 encryption (encrypting only the contents of the file, not the filename).

    You can compress files directly from the right-click menu, but you need to manually password protect zip file by clicking on the “Encrypt” button within the ZIP file, which is simple but basic, and suitable for light daily use. For more security (e.g. encrypting filenames) or flexibility, we recommend using a free utility such as 7-Zip.

    How to protect protect a zip file in Windows 11

    1. Right-click on the file or folder to be compressed and select "Compress to ZIP file".
    2. Double-click the generated ZIP file to go inside the zip archive.
    3. Click "Home" → "Encrypt" (lock icon) on the top menu bar.Enter the password and confirm it, click “OK”.
    4. Close the ZIP file window and the password takes effect immediately.
    5. When you open the ZIP again, the system will ask for the password.

    IMPORTANT:

    You must manually click "Encrypt" after compression, otherwise the file is not password protected.

    Encryption is only for the files in the current ZIP, new files will need to be re-encrypted.

  • ZekeHawkhill's avatar
    ZekeHawkhill
    Iron Contributor

    Password protecting a zip file is a great way to secure your files. There are several free methods you can use, and I’ll walk you through a couple of the easiest ways to do it, depending on your operating system. Let’s dive in! If you’re using Windows, you can use built-in tools to password protect a zip file, but it requires some command-line work. Here’s how:

    1. Create a New Folder: Put all the files you want to zip into a new folder.
    2. Create a Compressed (zipped) Folder:
    - Right-click the folder you created.
    - Go to “Send to” and select “Compressed (zipped) folder”.
    - This will create a new zip file.
    3. Password Protect a Zip file: Unfortunately, Windows doesn't natively support this, but you can use third-party software like 7-Zip for free.

    4. Download and Install 7-Zip: Go to the 7-Zip website and download it.
    5. Compress and Encrypt:
    - Right-click the folder you want to zip.
    - Hover over “7-Zip” and select “Add to archive…”.
    - In the options that pop up, there’s a section called “Encryption”.
    - Enter your desired password in the “Enter password” and “Reenter password” fields.
    - Make sure to select “Zip” or “7z” under “Archive format” and click “OK”.

    • PoorPossum's avatar
      PoorPossum
      Copper Contributor

      This is the only response that acknowledges that Windows DOES NOT have the ability to encrypt built-in.  Thank you.

Resources