What Is PGP and How Does It Work?

Two people exchanging a locked envelope, illustrating public-key message encryption

Introduction to Pretty Good Privacy (PGP)

Pretty Good Privacy (PGP) is a cryptographic system created in 1991 by Phil Zimmermann to provide privacy and authentication for digital communications. Originally designed to protect email messages and files from unauthorized interception, PGP has evolved into an open standard known as OpenPGP.

At its core, PGP solves two fundamental problems of internet communication: confidentiality (ensuring only the intended recipient can read a message) and authenticity (proving who actually sent a message and that it was not altered in transit). Whether you are a journalist protecting a source, a developer signing software releases, or an everyday user who values privacy, understanding PGP gives you direct control over your data.

Unlike proprietary messaging apps that lock you into a single platform, PGP is an interoperable standard. A message encrypted with our online PGP tool will generally decrypt in Thunderbird, GnuPG, or Proton Mail whenever both sides support the same algorithms—such as the widely compatible 2048-bit RSA profile.

A Short History of PGP and the OpenPGP Standard

When Phil Zimmermann released PGP in 1991, strong encryption was largely restricted to governments and large corporations. Publishing PGP as free software with source code made public-key cryptography accessible to ordinary citizens, journalists, and human rights workers.

In the years that followed, PGP also became a commercial product line—first through PGP Inc., later acquired by Network Associates, PGP Corporation, Symantec (Symantec Encryption Desktop), and eventually Broadcom. To ensure that everyone could build compatible encryption tools without proprietary lock-in, the Internet Engineering Task Force (IETF) formed the OpenPGP working group around 1997.

The OpenPGP working group published RFC 2440 in 1998, followed by the long-standing RFC 4880 in 2007, and the modern RFC 9580 (OpenPGP v6) in July 2024. While RFC 9580 introduces newer algorithms and 64-character SHA-256 fingerprints, older clients may not yet support v6 keys. This website currently uses OpenPGP.js v4.10.10 to generate widely interoperable v4 RSA-2048 keys.

Illustration of a document locked inside a vault with a small key, representing PGP hybrid encryption

Symmetric vs. Asymmetric Cryptography

To understand how PGP works, it helps to contrast two types of encryption: symmetric and asymmetric. In symmetric encryption, the same secret key is used to both lock (encrypt) and unlock (decrypt) a message. Symmetric algorithms such as AES (Advanced Encryption Standard) are very fast and secure, but they have a major practical drawback: how do you safely share the secret key with someone you have never met in person? If you send the key over ordinary email, anyone intercepting the email can read your messages.

Asymmetric cryptography—also called public-key cryptography—solves this key-distribution problem by using a mathematically linked pair of keys: a public key and a private key. Anything encrypted with a person's public key can only be decrypted by their corresponding private key. You can publish your public key on your website, in your email signature, or on a keyserver without compromising your security.

However, asymmetric algorithms like RSA are computationally slower than symmetric algorithms, especially for large files or long emails. That is why PGP combines both approaches into a design called hybrid encryption.

How PGP Hybrid Encryption Works Step by Step

When you encrypt a message in your browser using PGP, the software does not encrypt your entire text directly with RSA. Instead, it follows a fast, multi-step process:

First, PGP generates a random, one-time symmetric session key. Second, it encrypts your plaintext message using that session key with a fast symmetric cipher (typically AES-256). Third, it encrypts the small session key itself using the recipient's public key. Finally, it bundles the encrypted session key packet and the symmetrically encrypted data packet together into a single ASCII-armored text block starting with -----BEGIN PGP MESSAGE-----.

When the recipient receives this block, their PGP software uses their private key (unlocked by their passphrase) to decrypt the session key, and then uses that session key to decrypt the full message. This gives you the speed of symmetric encryption with the convenience of public-key distribution.

Digital Signatures: Proving Identity and Integrity

Encryption hides the contents of a message, but it does not prove who sent it—after all, anyone who has your public key can encrypt a message to you. To prove authorship and ensure a message has not been tampered with, PGP uses digital signatures.

When you sign a message, PGP calculates a cryptographic hash (a unique digest) of your text and signs that hash with your private key using a signature algorithm such as RSA or EdDSA. Anyone who has your public key can verify the signature. If even a single character in the message is changed after signing, the hash will no longer match and verification will fail.

In practice, you can sign a message without encrypting it (clear-signing, which is common for software announcements), encrypt without signing, or do both at once. You can test clear-signing and verification yourself using the Sign and Verify tabs on OnlinePGP.com.

ASCII Armor and Key Fingerprints

Raw OpenPGP packets are binary data, which can easily get corrupted when pasted into web forms or plain-text emails. To solve this, PGP uses ASCII Armor—a Base64 encoding wrapped in clear header and footer lines such as -----BEGIN PGP PUBLIC KEY BLOCK-----. This makes keys, signatures, and encrypted messages easy to copy, paste, and store.

Every PGP public key also has a cryptographic fingerprint. In OpenPGP v4 (which OnlinePGP.com generates), fingerprints are 40 hexadecimal characters derived from a SHA-1 hash of the key. In OpenPGP v6 (RFC 9580), fingerprints are 64 hexadecimal characters derived from SHA-256. Verifying a contact's fingerprint through a trusted channel ensures you are encrypting to the real person and not an impostor. Learn more in our guide on how to share your public key and verify fingerprints.

What PGP Does Not Do

Understanding PGP's boundaries is just as important as understanding its strengths. First, classic PGP does not hide metadata: your email provider can still see who is emailing whom, when the message was sent, and—unless both sides use modern header protection—the email subject line.

Second, PGP is not a real-time chat protocol with forward secrecy. If your private key is ever stolen and your passphrase is cracked, an attacker could decrypt past messages you saved. Third, PGP does not manage keys automatically for you; backing up your private key and verifying contacts' fingerprints remain your responsibility.

When PGP Is Still Useful Today

For everyday instant messaging with friends, modern end-to-end encrypted messengers like Signal are usually easier and provide forward secrecy. However, PGP remains uniquely valuable for encrypted email across different providers, encrypting files for long-term storage, signing software packages and Git commits, and communicating with journalists or organizations that publish a PGP public key.

To get started, read How to Generate a PGP Key Safely, compare standards in PGP vs GPG vs OpenPGP, or follow our step-by-step encryption tutorial.

Frequently Asked Questions

Is PGP still secure today?

Yes. When used with modern key sizes such as RSA-2048/4096 or Curve25519 (Ed25519/X25519) and a strong passphrase, OpenPGP remains cryptographically sound.

What is the difference between a public key and a private key?

Your public key is shared openly so others can encrypt messages to you or verify your signatures. Your private key must be kept secret and is used to decrypt messages and create signatures.

Can I use PGP without installing software?

Yes. You can generate a PGP key online and encrypt or decrypt messages directly in your browser using client-side OpenPGP.js tools like OnlinePGP.com.

How does PGP differ from Signal or WhatsApp?

Signal and WhatsApp are centralized, real-time messaging apps with automatic key management and forward secrecy. PGP is an open, decentralized standard designed primarily for email, files, and software signing across independent providers.

What is the difference between RSA and elliptic-curve PGP keys?

RSA relies on the difficulty of factoring large integers and typically uses 2048-bit or 4096-bit keys. Elliptic-curve keys such as Ed25519 and X25519 achieve comparable security with much shorter keys and faster operations.

Try It Now with OnlinePGP.com

Put this guide into practice right away. Generate a PGP key pair, encrypt a message, or verify a signature 100% locally in your browser.

Open the Online PGP Tool