📤 How to export GPG keys
📆 2026-10-06 08:05
There are two different things you can export: your public key for sharing, and your private key for backup. If you already created a backup for your key you can read:
If you don't have your backup then it's time to move on.
Export the public key
Or use the full fingerprint:
--armor makes it ASCII text, so public.asc will look like:
This is the key you can publish on a keyserver or give to other people.
Upload a GPG key to a keyserver
Once you have exported your public key, you can publish it on a GPG keyserver so others can find and import it. For example, to upload your key to:
- the Ubuntu keyserver:
- or to keys.openpgp.org:
Only the public key is uploaded. Your private key remains safely in your local keyring.
Export the private key
Create an unencrypted backup:
Never publish or send private.asc to a keyserver. Keep it somewhere secure.
Create an encrypted backup:
You can protect the exported private key with a separate passphrase:
Then you can safely store the encrypted backup on your hard drive or even in a git repository.
Now that you know how to export your key you can also read the tutorial below and learn how to use your key on another computer:
Keep private backups secure
A private-key backup contains secret cryptographic material. Never upload private.asc or an unencrypted secret-key export to a public server, keyserver, Git repository, or cloud location you don't fully trust. Prefer keeping an encrypted backup such as private.asc.gpg, protected by a strong passphrase. Store it somewhere secure, and consider keeping more than one backup in separate locations.
Your public key can be shared freely, but your private key and its passphrase must remain secret.
🪙 Donate
If this tutorial saved you time, sanity, or a mild existential crisis... consider fueling future chaos with a small donation: