PGP Encrypt & Decrypt Online | OpenPGP GPG Key Generator Browser

Encryption
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.
⚠️ Critical Security: Always verify the recipient's public key fingerprint through a separate trusted channel before encrypting sensitive data. Protect your private key with a strong passphrase. For bulk file encryption, consider AES-256-GCM instead — PGP is best for email and messaging scenarios.

How It Works

What Is OpenPGP Encryption?

OpenPGP (Pretty Good Privacy) is a hybrid encryption standard defined in RFC 4880. It combines the speed of symmetric encryption (like AES or ChaCha20) with the key distribution advantages of public-key cryptography (like RSA or ECC). A message is encrypted with a randomly generated session key, which is then encrypted with the recipient's public key. Only the holder of the corresponding private key can decrypt the session key and, in turn, the message.

This tool implements OpenPGP encryption, decryption, signing, and verification using openpgp.js. It is fully compatible with GnuPG (GPG) and other PGP implementations. Two encryption modes are available: public key (asymmetric, for sending to specific recipients) and password (symmetric, for shared-secret scenarios). All cryptographic operations run locally in your browser — no data is sent to any server.

When to Use PGP

  • Email encryption — Secure email communication using PGP/MIME or inline PGP
  • File signing — Prove the authenticity and integrity of software releases or documents
  • Messaging — End-to-end encrypted messages via any channel (chat, forums, etc.)
  • Key distribution — Share encrypted data with specific recipients without pre-sharing secrets
  • Cleartext signatures — Sign announcements or emails while keeping the message readable
  • When NOT to use — For bulk data encryption between your own systems, use AES-256-GCM directly

Key Algorithm Comparison

AlgorithmKey SizeSignature SizeGeneration SpeedBest for
ECC (Curve25519)256-bit~64 bytesVery fastModern use, email, messaging
RSA2048–4096-bit256–512 bytesSlowerLegacy compatibility, enterprise

Standards Compliance

  • RFC 4880 — OpenPGP Message Format specification
  • RFC 4880bis — Updated OpenPGP specification (in progress)
  • RFC 6637 — ECC in OpenPGP (Curve25519, NIST curves)
  • GnuPG — Fully compatible with GPG command-line tool
  • openpgp.js — IETF OpenPGP Working Group reference implementation

Last updated:

Code Examples

Encrypt and sign messages with OpenPGP in multiple languages:

JavaScript — openpgp.js (Browser)

// PGP encrypt with public key
import * as openpgp from 'openpgp';

const publicKey = await openpgp.readKey({ armoredKey: pubKeyArmored });
const message = await openpgp.createMessage({ text: 'secret message' });
const encrypted = await openpgp.encrypt({
  message,
  encryptionKeys: publicKey,
});
console.log(encrypted); // ASCII-armored PGP block

Python — GnuPG (python-gnupg)

import gnupg

gpg = gnupg.GPG()
with open('recipient.pub.asc') as f:
    gpg.import_keys(f.read())

encrypted = gpg.encrypt('secret message', '[email protected]')
print(str(encrypted))  # ASCII-armored PGP output

Go — gopenpgp

import "github.com/ProtonMail/gopenpgp/v2/crypto"

publicKey, _ := crypto.NewKeyFromArmored(recipientPubKey)
keyRing, _ := crypto.NewKeyRing(publicKey)

message := crypto.NewPlainMessageFromString("secret message")
encrypted, _ := keyRing.Encrypt(message, nil)
fmt.Println(encrypted.GetArmored())

Rust — pgp crate

use pgp::composed::{SignedPublicKey, Message};
use pgp::types::SecretKeyTrait;

// Parse armored public key
let pubkey = SignedPublicKey::from_string(armored_key)?;
// Create and encrypt message
let message = Message::new_literal("hello", "secret message");
let encrypted = message.encrypt_to_keys(&rng, &[&pubkey.primary_key])?;

Node.js — openpgp (CommonJS)

const openpgp = require('openpgp');

async function encryptMessage(pubKeyArmored, text) {
  const publicKey = await openpgp.readKey({ armoredKey: pubKeyArmored });
  const message = await openpgp.createMessage({ text });
  return openpgp.encrypt({ message, encryptionKeys: publicKey });
}

encryptMessage(pubKey, 'secret message')
  .then(encrypted => console.log(encrypted));

Common Pitfalls

⚠️ Not Verifying Key Fingerprints: Always confirm the recipient's public key fingerprint through a separate trusted channel (phone call, in-person meeting). Without verification, a man-in-the-middle could substitute their own key.
⚠️ Weak Private Key Passphrase: Your private key is only as secure as the passphrase protecting it. Use a high-entropy passphrase (20+ characters). A weak passphrase means anyone with access to your key file can decrypt your messages.
⚠️ Using RSA for New Keys: RSA requires much larger keys (2048–4096 bits) for equivalent security. ECC Curve25519 provides 128-bit security with just 256-bit keys, faster operations, and shorter signatures. Choose ECC unless you need legacy compatibility.
⚠️ Password Mode Requires Secure Channel: When using password-based encryption, the shared password must be communicated through a separate secure channel. If the channel is compromised, so is the encryption.
⚠️ Signing Without Encrypting: A cleartext signature proves authenticity but does not hide the message content. If confidentiality is also needed, encrypt first, then sign (encrypt-then-sign).

Security Notes

ℹ️ Prefer ECC (Curve25519): Curve25519 offers equivalent security to RSA-3072 with much smaller keys and faster operations. It is the modern default for OpenPGP implementations.
ℹ️ Multiple Recipients: PGP supports encrypting a message to multiple recipients — each recipient's public key encrypts a copy of the session key. The message body is encrypted only once.
ℹ️ Cleartext vs Detached Signatures: Cleartext signatures keep the message readable (ideal for emails). Detached signatures separate the signature from the message (ideal for file verification). Both are supported.
ℹ️ Key Expiration: Set an expiration date on your PGP keys. Expired keys cannot be used for new encryption, reducing the window of exposure if a key is compromised.

Disclaimer

This tool is provided for educational and development purposes. PGP security depends on proper key management, which is the user's responsibility. For production systems, follow GnuPG best practices and RFC 4880 specifications. Always verify key fingerprints through trusted channels.

Further Reading

Related Concepts

Related Tools

Need symmetric encryption instead? Try AES Encrypt/Decrypt for fast, key-based encryption. To generate RSA key pairs for use with PGP, the RSA Key Generator creates keys in PEM format. For interactive key exchange demonstrations, try the ECDH Key Exchange tool.

Frequently Asked Questions

Can I use this with GnuPG (GPG) keys?

Yes. This tool uses the OpenPGP standard (RFC 4880), the same protocol implemented by GnuPG. Export your GPG key with "gpg --armor --export [email protected]" and paste it here. Messages encrypted in this tool can be decrypted with GPG, and vice versa.

Which algorithm should I choose — ECC or RSA?

ECC (Curve25519) is recommended for most users: it produces shorter keys and signatures, is faster to generate, and offers equivalent security to RSA with much smaller key sizes. RSA (2048–4096 bits) is the traditional choice and has broader legacy compatibility. If you are unsure, choose ECC.

What is the difference between public key and password encryption?

Public key encryption uses the recipient's public key — only their private key can decrypt. It is ideal for sending messages to specific people without sharing secrets beforehand. Password encryption uses a shared password that both sender and recipient must know — simpler but requires a secure channel to share the password. Choose public key for most use cases.

What is the Key Generator for?

The built-in Key Generator creates a fresh PGP key pair (ECC Curve25519 or RSA) directly in your browser. Generated keys can be downloaded as .asc files or used immediately in the Encrypt, Decrypt, and Sign modes via the "Use this key pair" button. This is useful for testing, learning, or generating keys for non-critical use cases.

Can I sign a message without encrypting it?

Yes. The Sign mode supports two formats: Cleartext Signature (the message stays readable with a signature block appended — ideal for emails and announcements) and Inline Signature (the message is wrapped inside an opaque armored block — suitable when the content should not be visible without verification). The recipient uses the Verify mode with your public key to confirm authenticity.

Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.

More in Encryption