PGP Key Generator

Generate an OpenPGP key pair in your browser. Curve25519, NIST curves or RSA up to 4096-bit, with passphrase and expiry. Key never leaves your device.

Advertisement

Free Online PGP Key Generator — Create an OpenPGP Key Pair in Your Browser

This PGP key generator creates a complete OpenPGP key pair — public key, private key, fingerprint and key IDs — entirely inside your browser. Enter a name and email, choose a key type and an expiration, set a passphrase, and the tool produces ASCII-armored keys you can download or copy. Key generation uses the OpenPGP.js library running as client-side JavaScript. The private key is created on your machine and never leaves it: there is no upload, no server-side generation, and no account.

That distinction matters more here than for almost any other tool on this site. A private key is the whole secret. Any web service that generates a key pair on its server has, by definition, seen your private key. This one cannot, because the cryptography happens in the page you already loaded — you can verify that by opening your browser’s network tab during generation, or by disconnecting from the network after the page loads and generating a key anyway.

Handle the Private Key Carefully

Client-side generation removes the server from the trust equation, but it does not remove the other risks, and you should be clear-eyed about them:

  • The key is generated on whatever machine you are using. If that machine is shared, managed by someone else, or compromised, the key is not trustworthy. Generate on a device you control.
  • Always set a strong passphrase. It encrypts the private key at rest, so a stolen key file is not immediately a stolen identity.
  • Download the private key to secure storage or a password manager immediately, then close the tab. Do not leave it sitting in a browser window.
  • Never email, paste into a chat, upload to a ticket, or commit a private key anywhere. Only the public key is meant to be shared.
  • For production and organisational use, keys are normally generated on the system that will use them — with gpg --full-generate-key on the server, or directly on a hardware token such as a YubiKey or a smartcard, so the private key never exists as a file at all. This tool is best suited to personal keys, learning, testing and one-off encryption tasks.

How to Generate a PGP Key

  1. Enter your identity. Name and email are required and become the key’s user ID, in the form Name (comment) <email>. Use the email address people will actually use to reach you; correspondents look keys up by it.
  2. Choose a key type. Seven options are available: ECC Curve25519, ECC NIST P-256, P-384 and P-521, and RSA 2048, 3072 and 4096.
  3. Set an expiration. Never, one year, two years, or a custom number of days.
  4. Set a passphrase. This encrypts the private key. There is no recovery if you forget it.
  5. Generate, then copy or download the public key, the private key, the fingerprint and the key IDs. A QR code of the public key is also produced for easy transfer to a phone.

Choosing a Key Type

Key typeApprox. security levelNotes
ECC Curve25519~128-bitRecommended default. Fast generation, small keys, fast signatures, no NIST-curve concerns. Supported by GnuPG 2.1+ and every modern client.
ECC NIST P-256~128-bitWidely supported, including in FIPS-constrained environments. Choose when a compliance regime names NIST curves.
ECC NIST P-384~192-bitHigher margin; still broadly supported.
ECC NIST P-521~256-bitHighest NIST curve, but the least consistently supported. Verify your correspondents’ tooling first.
RSA 2048~112-bitThe floor for RSA. Use only where something old cannot handle anything else.
RSA 3072~128-bitThe RSA equivalent of Curve25519’s strength, at roughly 24 times the key size.
RSA 4096~140-bitMaximum practical RSA. Noticeably slower to generate; the extra margin over 3072 is modest.

Unless you have a specific compatibility or compliance reason, pick Curve25519. The elliptic-curve keys are a fraction of the size of RSA at equivalent strength, generate in a moment rather than tens of seconds, and produce much smaller signatures — which is why they have become the default in modern OpenPGP tooling.

Understanding Fingerprints and Key IDs

Every OpenPGP key has a 160-bit fingerprint, normally shown as 40 hexadecimal characters. The tool also shows a long key ID (the last 16 hex characters of the fingerprint) and a short key ID (the last 8). Only the full fingerprint should ever be used for verification. Short key IDs are just 32 bits and collisions have been generated deliberately — in 2016 a well-publicised exercise produced colliding short IDs for a large number of prominent keys on the public keyservers. If someone asks you to confirm a key, compare all 40 characters, ideally over a channel other than the one that delivered the key.

A worked example of the shape of these values:

Fingerprint:   3F5A 9C21 8E4B 7D06 1A93  C852 BB40 17FE 6D2C 90A1
Long key ID:   BB4017FE6D2C90A1
Short key ID:  6D2C90A1

Expiration Is a Safety Net, Not a Deadline

Setting an expiration date is good practice, and the common objection — “I do not want to lose my identity in two years” — misunderstands how it works. An expiration date on an OpenPGP key can be extended at any time by the key holder, as long as you still have the private key and passphrase. Its real function is a dead-man’s switch: if you lose access to the key or simply stop using it, it eventually stops being presented to the world as a valid way to reach you. A key set to never expire and then lost stays on the keyservers forever, and people will keep encrypting mail you can no longer read.

Two years is a reasonable default. If you generate a key here that you intend to keep, also generate a revocation certificate in your local GnuPG installation once you import the key — that is what lets you retire the key if the passphrase is lost.

Using the Key with GnuPG

To import the key pair you just generated into GnuPG, save each block to a file and run:

gpg --import public-key.asc
gpg --import private-key.asc
gpg --list-secret-keys --keyid-format LONG
gpg --edit-key you@example.com trust

Then encrypt and sign in the usual way:

gpg --encrypt --sign --armor -r recipient@example.com message.txt
gpg --decrypt message.txt.asc
gpg --detach-sign --armor release.tar.gz

To publish the public key so others can find it, export the armored public block and upload it to a keyserver or, better, publish it via Web Key Directory on your own domain so verification is tied to a domain you control.

Related Tools

For TLS rather than email — certificate signing requests, self-signed certificates and format conversion — use the certificate CSR generator, and inspect existing certificates with the X.509 certificate decoder. The secure password generator is a good way to produce the passphrase that protects this key, and the hash generator covers the checksum side of verifying downloads you have just validated a signature on.

Frequently Asked Questions

Is it safe to generate a PGP key in a browser?

The generation itself runs locally using OpenPGP.js and the browser’s cryptographic random number generator, and nothing is transmitted. The risk that remains is the machine you are using: generate only on a device you control and trust, set a strong passphrase, and move the private key straight into secure storage. For organisational or high-value keys, generate on the target system or on a hardware token instead.

What is the difference between PGP, OpenPGP and GPG?

PGP was the original 1991 program. OpenPGP is the open standard describing the message and key formats. GPG (GnuPG) is the widely used free implementation of that standard. Keys generated here follow the OpenPGP standard and therefore work with GnuPG and other compliant clients.

Which key type should I choose?

ECC Curve25519 unless you have a reason not to. Choose a NIST curve if a compliance regime requires it, or RSA 3072/4096 if you must interoperate with older software that predates elliptic-curve OpenPGP support.

Can I recover my key if I forget the passphrase?

No. The passphrase encrypts the private key and there is no backdoor, no reset and no recovery. If you lose it, the key is gone — which is precisely why you generate a revocation certificate while you still have access.

What is the difference between the public and private key?

The public key is for distribution: people use it to encrypt messages to you and to verify your signatures. The private key stays with you and is used to decrypt and to sign. Share the public key freely; never share the private key.

Why does RSA 4096 take so long to generate?

RSA key generation must find two large random primes, which is a search process with no fixed running time. At 4096 bits that can take tens of seconds even on fast hardware. Elliptic-curve keys have no such step and generate almost instantly.

Can I use this key for signing Git commits?

Yes. Import the key into GnuPG, then set git config user.signingkey <long key ID> and git config commit.gpgsign true. Add the public key to your Git host so signatures show as verified.

What happens when my key expires?

Clients stop treating it as valid for new encryption and warn on signature verification. Existing signatures made before expiry generally still verify. You can extend the expiration at any time with the private key, so expiry is recoverable in a way that a lost passphrase is not.

Should I upload my public key to a keyserver?

It makes you findable, but the older SKS-style keyservers cannot delete anything, so treat an upload as permanent and public — including the email address in the user ID. Modern options such as keys.openpgp.org require email confirmation and support removal, and Web Key Directory on your own domain gives you the most control.

Does the tool keep a copy of my key?

No. Generation happens in your browser tab; the key exists in that page’s memory and in whatever you download. Close the tab and it is gone, so download it before you leave.

What Is PGP Key Generation

PGP (Pretty Good Privacy) key generation creates a mathematically linked pair of cryptographic keys—a public key and a private key—used for encrypting messages, signing files, and verifying identity. PGP has been a cornerstone of secure communication since Phil Zimmermann released it in 1991, and its open standard (OpenPGP, defined in RFC 4880) remains widely used for email encryption, software distribution verification, and secure file transfer.

The core principle is asymmetric cryptography: the public key encrypts data that only the corresponding private key can decrypt, and the private key creates signatures that anyone with the public key can verify. This eliminates the need to share secret keys through insecure channels—a fundamental problem in symmetric cryptography.

How PGP Key Pairs Work

A PGP key pair consists of several components:

ComponentPurposeVisibility
Public keyEncrypt messages to you; verify your signaturesShared freely
Private keyDecrypt messages sent to you; create signaturesNever shared
User IDAssociates name and email with the keyPublic
SubkeysSeparate keys for signing, encryption, authenticationLinked to primary
Key ID / FingerprintUnique identifier for the key (last 8/16 hex chars or full 40-char SHA-1)Public
Expiration dateWhen the key automatically becomes invalidPublic

Key algorithm options:

  • RSA 4096: Widely compatible, well-understood security properties, larger key size
  • Ed25519 (EdDSA): Modern elliptic curve algorithm, smaller keys, faster operations, recommended for new keys
  • Curve25519 (ECDH): Used for encryption subkeys alongside Ed25519 signing keys

When generating a key, the generator creates random prime numbers (RSA) or curve points (ECC), derives the key pair, and packages everything into the OpenPGP format with your user ID and self-signature.

Common Use Cases

  • Email encryption: Encrypt email with the recipient's public key so only they can read it (using tools like GPG, Thunderbird, or Mailvelope)
  • Software signing: Sign release packages so users can verify the software wasn't tampered with (used by Linux distributions, Python packages, and Git commits)
  • Git commit signing: Sign commits with your PGP key to prove authorship and integrity
  • File encryption: Encrypt sensitive files before storing them in cloud storage or transmitting over insecure channels
  • Identity verification: Publish your public key to keyservers or your website to enable others to verify your digital signatures

Best Practices

  1. Use Ed25519 for new keys — Modern elliptic curve keys are smaller, faster, and have no known backdoor concerns
  2. Set an expiration date — Keys should expire within 1-2 years; you can always extend the expiration before it lapses
  3. Protect your private key with a strong passphrase — The passphrase encrypts your private key at rest; use a unique, high-entropy passphrase
  4. Create a revocation certificate immediately — Store it securely offline so you can revoke the key if the private key is compromised
  5. Back up your private key offline — Store an encrypted backup on a USB drive in a physically secure location separate from your computer

Frequently Asked Questions

What is PGP and why should I use it?+

PGP (Pretty Good Privacy) is an encryption program that provides cryptographic privacy and authentication for data communication. It is used for signing, encrypting, and decrypting texts, emails, files, and more. PGP helps protect your sensitive communications from unauthorized access and ensures message authenticity.

Are my keys generated securely?+

Yes, all PGP keys are generated entirely in your browser using client-side JavaScript. Your private key never leaves your device and is not transmitted to any server. This tool uses the OpenPGP.js library, which implements the OpenPGP standard for secure key generation.

Which key type should I choose: ECC or RSA?+

For new keys, we recommend ECC Curve25519 as it offers excellent security with better performance and smaller key sizes than RSA. ECC keys are modern and widely supported. RSA keys (2048, 3072, or 4096 bits) are still secure but are considered legacy and should only be used when compatibility with older systems is required.

Should I set a passphrase for my key?+

Yes, setting a strong passphrase is highly recommended. A passphrase encrypts your private key file, so even if someone gains access to your private key file, they cannot use it without knowing the passphrase. Choose a long, memorable passphrase that is difficult to guess.

Why should I set an expiration date on my key?+

Setting an expiration date provides an additional security layer. If your key is ever compromised, the damage is limited to the expiration period. It also encourages good key hygiene by prompting you to rotate keys periodically. We recommend setting a 2-year expiration for most use cases.

What is the difference between my public and private key?+

Your public key can be shared freely with anyone who wants to send you encrypted messages or verify your digital signatures. Your private key must be kept secret and secure, as it is used to decrypt messages sent to you and create digital signatures. Never share your private key with anyone.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.