ShortIQ

ShortIQ

Deployment

PPK vs PEM: What Is the Difference and When to Use Each

PPK and PEM are both private key formats used for SSH, but they work with different tools. This guide explains the difference, when you need each format, and how to convert between them.

May 30, 2026ShortIQ Editorial Team

Advertisement

What Is a PEM File

PEM stands for Privacy Enhanced Mail, though the name is mostly historical. In practice, a PEM file is a Base64-encoded container format used to store cryptographic objects including private keys, public keys, and certificates. The file starts with a header like -----BEGIN RSA PRIVATE KEY----- or -----BEGIN OPENSSH PRIVATE KEY----- and ends with a matching footer.

PEM is the default format for OpenSSH, which is what most Linux servers, macOS terminal sessions, Git, and CI/CD tools use. AWS, DigitalOcean, and most cloud providers generate and accept PEM keys. When you download a key pair from the AWS EC2 console, the file you get is a .pem file.

On Linux and macOS, you use PEM keys directly with the ssh command: ssh -i my-key.pem ubuntu@server-ip. No conversion is needed. PEM is the native format for the open-source SSH ecosystem.

  • Used by OpenSSH, the standard SSH client on Linux and macOS
  • Default format for AWS EC2 key pairs, DigitalOcean, and most cloud providers
  • Works directly with ssh -i key.pem commands and Git over SSH
  • File header identifies the key type: BEGIN RSA PRIVATE KEY or BEGIN OPENSSH PRIVATE KEY

What Is a PPK File

PPK stands for PuTTY Private Key. It is a proprietary format created by the PuTTY project for storing SSH private keys on Windows. The file uses a different encoding and structure than PEM and is not directly interchangeable.

PuTTY is the most widely used SSH client on Windows. When you connect to a Linux server from Windows using PuTTY, you need your private key in PPK format. PuTTY cannot read PEM files directly. You must convert the PEM file to PPK using PuTTYgen, which is the companion key management tool that ships with PuTTY.

PPK files are only needed in the PuTTY ecosystem: PuTTY itself, WinSCP (which uses PuTTY for SSH), Pageant (the PuTTY authentication agent), and a few older Windows SSH tools. Outside of that ecosystem, PPK format is not standard and not supported by other tools.

  • Proprietary format used exclusively by PuTTY and related Windows tools
  • Required for PuTTY SSH client, WinSCP, and Pageant on Windows
  • Not compatible with OpenSSH or any standard Linux and macOS SSH tool
  • Created and converted using PuTTYgen, which ships with PuTTY

PPK vs PEM: Key Differences

The core difference is the tool ecosystem each format belongs to. PEM is the standard used by OpenSSH and nearly every modern SSH tool. PPK is a Windows-specific format used only by the PuTTY suite.

Security-wise, both formats store the same underlying private key data. A PPK file converted from a PEM file contains the same cryptographic key. The format determines which tools can read it, not the security level.

PEM is the right default for most workflows. Only convert to PPK when you specifically need to use PuTTY on Windows. Keeping the PEM file as your source of truth means you can always regenerate the PPK when needed.

  • PEM: standard OpenSSH format, works on Linux, macOS, Windows OpenSSH, and all cloud providers
  • PPK: PuTTY-specific, Windows only, not supported by OpenSSH or standard tools
  • Same underlying key data: converting between formats does not change the cryptographic key
  • PEM is the right default: only convert to PPK when specifically using PuTTY

How to Convert PEM to PPK Using PuTTYgen

You need PuTTYgen installed. It comes bundled with PuTTY when you download it from putty.org. Open PuTTYgen, click Load, and change the file filter from PuTTY Private Key Files to All Files so your .pem file appears in the dialog.

Select your .pem file. PuTTYgen imports it and shows the key fingerprint. If the key is passphrase-protected, enter the passphrase when prompted. Once loaded, click Save private key. The saved file is a .ppk file ready to use in PuTTY, WinSCP, or Pageant.

On Linux, the putty-tools package includes a command-line puttygen that converts keys without the GUI. This is useful in scripts or when working on a headless server.

bash
# Linux command line (install putty-tools first)
sudo apt install putty-tools

# Convert PEM to PPK
puttygen my-key.pem -o my-key.ppk

# Or with an explicit output type flag
puttygen my-key.pem -o my-key.ppk -O private

How to Convert PPK Back to PEM

If you have a PPK file and need to use it with OpenSSH, you need to convert it back to PEM. Open PuTTYgen, click Load and select your .ppk file. Once loaded, go to Conversions and then Export OpenSSH key. Save the file with a .pem extension.

On Linux, puttygen handles this from the command line. After converting, set the correct file permissions with chmod 400 before using the key with ssh.

bash
# Convert PPK back to PEM (OpenSSH format)
puttygen my-key.ppk -O private-openssh -o my-key.pem

# Set correct permissions (required by SSH)
chmod 400 my-key.pem

# Test the converted key
ssh -i my-key.pem ubuntu@your-server-ip

Common Errors When Using the Wrong Key Format

"Error loading key: bad permissions" is not a format error. It means the PEM file permissions are too open. SSH refuses to use a private key that other users can read. Run chmod 400 my-key.pem to fix it.

"Unable to load key file" in PuTTY usually means you are trying to load a PEM file directly without converting it first. PuTTY expects a .ppk file. Use PuTTYgen to convert, then load the .ppk in PuTTY.

"Invalid format" when converting often means the PEM file was created or edited on Windows and has CRLF line endings instead of LF. Run dos2unix my-key.pem on Linux to fix the line endings before converting.

  • chmod 400 key.pem fixes bad permissions errors on Linux and macOS
  • PuTTY cannot load .pem files directly: always convert to .ppk first
  • Use dos2unix on Linux if a PEM file was created or edited on Windows
  • Both PEM and PPK can be passphrase-protected: enter the original passphrase when converting

FAQ

What is the difference between PPK and PEM files?

PEM is the standard OpenSSH key format used by Linux, macOS, and most cloud providers. PPK is a PuTTY-specific format used only on Windows with PuTTY. Both store the same private key data, but the format determines which tools can read the file.

Can PuTTY use a PEM file directly?

No. PuTTY requires PPK format. Convert the PEM file to PPK using PuTTYgen: open PuTTYgen, load the .pem file with the All Files filter, then save it as a .ppk file.

Can OpenSSH on Windows use a PPK file?

No. The OpenSSH client built into Windows 10 and 11 uses PEM format, not PPK. If you want to use OpenSSH on Windows instead of PuTTY, keep your key in PEM format or convert the PPK back to PEM using PuTTYgen via Conversions and then Export OpenSSH key.

Does converting between PPK and PEM change the key?

No. The underlying cryptographic key is the same. Converting only changes the file format and encoding. The public key fingerprint and the server-side authorized_keys entry remain unchanged.

Which format should I use by default?

Keep your private key in PEM format as the default. Only convert to PPK when you specifically need to use PuTTY on Windows. PEM works on Linux, macOS, Windows OpenSSH, Git, CI/CD pipelines, and all major cloud providers.

How do I fix bad permissions on a PEM file?

Run chmod 400 my-key.pem on Linux or macOS. This restricts the file to read-only by the owner, which is what SSH requires. On Windows with OpenSSH, remove all permissions except your own user account via the file properties Security tab.

Related free tools

If you want to turn this topic into action, use one of ShortIQ's free tools for campaign planning, UTM structure, or QR distribution.

Continue Reading

Explore more guides on link shortener SaaS strategy, Bitly alternatives, and white label link management.

Free newsletter

Get new guides in your inbox

We publish practical guides on dev tooling, prompt engineering, marketing workflows, and deployment. No fluff — straight to the point.

No spam. Unsubscribe any time.

Was this article helpful?

Tell us if this guide solved the problem or what was still missing. We use this to improve the blog and only follow up if you explicitly allow it.

We use this to improve tutorials, examples, and technical depth.