Articles

What is an age key, and how do I make one?

An age key is a key pair for the age encryption tool, a small file encryption tool and format by Filippo Valsorda. Each half is one line of text:

Text
public key:  age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
secret key:  AGE-SECRET-KEY-1…  (58 more characters, never shown to anyone)

Anything encrypted to the public key can be decrypted only with the secret key. That is the whole model: no keyrings, no configuration and no key servers. The format is specified at c2sp.org/age and implemented in Go (the reference), in Rust (rage), and in other languages.

What do age1… and AGE-SECRET-KEY-1… mean?

The age format calls the public key a recipient and the secret key an identity. Both are Bech32 strings, the encoding Bitcoin addresses use. A Bech32 string has three parts:

part in age1zclk…ech8 meaning
human-readable prefix age what kind of key this is
separator 1 the last 1 in the string
data and checksum zclk…ech8 32 bytes of key, then 6 checksum characters

The checksum is why a mistyped key fails loudly instead of encrypting to the wrong key, and the alphabet leaves out 1, b, i and o so that characters are hard to confuse by eye. The prefixes tell you the kind of key at a glance:

starts with kind
age1 + 58 characters classic X25519 public key
AGE-SECRET-KEY-1 classic X25519 secret key
age1pq1 + about 1,950 characters post-quantum hybrid public key (ML-KEM-768 with X25519)
AGE-SECRET-KEY-PQ-1 post-quantum hybrid secret key
age1tag1 or age1tagpq1 a key held in hardware, such as a YubiKey, classic or post-quantum
age1 + a plugin name + 1 a key handled by another plugin
ssh-ed25519 AAAA… or ssh-rsa AAAA… an SSH public key, which the tool also accepts as a recipient (not post-quantum)

The classic secret key is 32 random bytes. The public key is computed from it by X25519, the elliptic-curve function in RFC 7748, so the secret key alone is enough to rebuild the public key, and age-keygen -y does exactly that.

How do I make an age key pair?

Install the age encryption tool (brew install age on macOS, apt install age on Debian 12 or later and Ubuntu 22.04 or later, winget install --id FiloSottile.age on Windows, others in the README). Then:

Shell
age-keygen -o key.txt

That writes the secret key to key.txt, readable only by you, and prints the public key. What kind of key you get depends on your version, which age --version tells you:

version age-keygen with no flags makes for a classic X25519 pair
1.4.0 or later a post-quantum hybrid pair age-keygen -pq=false -o key.txt
1.3.x a classic pair (-pq opts in to post-quantum) age-keygen -o key.txt
1.2.1 or earlier a classic pair (no post-quantum support) age-keygen -o key.txt

We ran all three versions to fill that table. Version 1.2.1 rejects the flag with flag provided but not defined: -pq.

You can also make a classic pair in your browser with the free key tools on the home page. The key is made on your device by a WebAssembly module and nothing is sent; you can confirm that by watching the Network tab of your browser's developer tools, or by making a key with your network turned off.

The key file looks like this:

Text
# created: 2026-12-05T20:17:58Z
# public key: age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
AGE-SECRET-KEY-1…

Lines starting with # are comments, so the whole file is a valid identity file. If you lose track of the public key, recover it:

Shell
age-keygen -y key.txt

Should I use a post-quantum key or a classic one?

Version 1.4.0 of the age encryption tool, released on 1 December 2026, made post-quantum keys the default and started warning on every use of a classic one:

Text
age: warning: the encrypted file could be decrypted by a future quantum computer, see https://age-encryption.org/pq-warning

The concern is "store now, decrypt later": someone who records a file encrypted to a classic X25519 key today could decrypt it once a large enough quantum computer exists. The project's explanation recommends making post-quantum keys and re-encrypting files that were encrypted to classic ones. Files encrypted with a passphrase (age -p) are not affected.

How to decide:

Text
age: error: incompatible recipients: can't mix post-quantum and classic recipients, or the file would be vulnerable to quantum computers

The specification says a file encrypted to a post-quantum recipient should not also be encrypted to non-quantum-resistant recipient types. A file is only as strong as its weakest recipient.

SecureSecretStore's design uses classic X25519 keys, and its free tools make and check that kind. We say so here because you should know which kind you are choosing.

How do I check an age public key?

A public key is checked in two ways:

  1. Is it well formed? The Bech32 checksum and length tell you whether the string is a real key. The free fingerprint tool on the home page does this in your browser.
  2. Is it really theirs? A well-formed key can still belong to someone else. Compare a short fingerprint of the key with its owner over a second channel. Check a fingerprint explains how, with a standard-library Python script that computes the same fingerprint as the home page's fingerprint tool. (The age format itself defines no fingerprint; this one is SecureSecretStore's.)
Terminal
$ python3 age-fingerprint.py age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
05c6 f091 667b d9bc caf0 bd0a 496d 871d

How do I encrypt and decrypt with it?

Encrypt to a public key with -r; decrypt with an identity file with -i:

Shell
printf 'sk_test_example_value\n' | age -r age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8 -o test.age
age -d -i key.txt test.age

To encrypt to several people or machines, list one public key per line in a file and pass it with -R:

Shell
age -R readers.txt -o shared.age secret.txt

Here is the start of a real file encrypted to three classic keys. Each -> X25519 line is one recipient stanza: the file key, wrapped for one reader.

Text
age-encryption.org/v1
-> X25519 QisuYKvxaTKrHoqRSatXspwfhog67uCzqt84Q4MppEs
GZuQ3iCu7eMLG0HaHYWZINN7OLo6xhmI/46ZCo+B3QA
-> X25519 yXMKcyreYBgpiMAin9E2AcmQ7wOY0PJq9YAz511EBm0
MOM8mefWeHZa9fdiSC+bCowMO1skAk0C6Jnbyfyv8AI
-> X25519 w3j8NzB26zpfPKkBVGEvR7AiWbclTe+yYUelocEppQ4
wbxdo9DLdTVsbTb3sBzTNSUobMFGhjO3lpl+BgStElA
--- QLhhR1/2WL4zxW1P/8SILGhWUXzs4SF+6C9eiGUDfdI

Notice what the header does not contain: any of the three public keys. An X25519 stanza holds only a fresh ephemeral share and the wrapped key, so the file shows how many readers it has, but not who they are. (SSH recipients are different: the README notes they embed a short tag of the public key in the file.) The file also does not say who encrypted it. Anyone with your public key can encrypt to you, and the age encryption tool does not sign files.

age-inspect, added in version 1.3.0, summarizes a file without decrypting it:

Terminal
$ age-inspect shared.age
shared.age is an age file, version "age-encryption.org/v1".

This file is encrypted to the following recipient types:
  - "X25519"
  - "X25519"
  - "X25519"

This file does NOT use post-quantum encryption.
…

The rest of the output is a size breakdown, which shows the exact length of the encrypted value.

Where should each key live?

Make one key pair per device: one for your laptop, one for your phone's app, one for each server and one for each AI agent's runtime. A secret key that never leaves its device cannot leak from anywhere else, and a lost device is removed on its own without replacing the others.

Keep one more key offline, printed or on a USB drive in a safe place, and add it as a recipient to everything. That is your recovery key, and Lost a device or your keys? How recovery works explains why it matters.

Common questions

Is an age key the same as an SSH key? No, but the age encryption tool accepts ssh-ed25519 and ssh-rsa public keys as recipients, and the matching SSH private key as an identity. A dedicated age key is simpler and, unlike an SSH key, hides which key a file is encrypted to. SSH keys are also not post-quantum, so version 1.4.0 warns when you use one.

Can I protect the secret key file with a passphrase? Yes: age-keygen | age -p > key.age, then pass key.age to -i, and the tool asks for the passphrase. The README notes that passphrase-protected identity files are not necessary for most use cases, "where access to the encrypted identity file implies access to the whole system."

Is it safe to publish my public key? Yes. That is what it is for. Publish the fingerprint alongside it, so people can check they copied the right one.

How do I see which kind of key I have? Look at the prefix: age1pq1 is post-quantum, age1 followed directly by the key data is classic X25519.

For agents and tools: llms.txt. AI version of this article.