Nostr key generator and converter (nsec / npub)
Generate a Nostr key pair and convert keys between hex and NIP-19 (nsec / npub). Derive the public key from a private key. Keys stay in your browser and are never saved or sent.
This page does not load analytics or ad scripts.
Anyone who knows your private key (nsec) can post anything as you. Never show it to anyone or paste it into sites you do not trust. This page does not save or send keys; they are gone when you close the page.
Enter nsec1… / npub1… or 64 hex characters. Surrounding spaces and "nostr:" are ignored.
Public key (safe to share)
Private key (never share)
How to use
- To create keys, keep "Generate new" and press "Generate key pair".
- To convert, choose "Convert a key", select whether you are entering a private or a public key, enter nsec1… / npub1… or 64 hex characters and press "Convert".
- The public key (npub and hex) and an npub QR code appear. The QR code can be saved as PNG.
- The private key starts hidden. Press "Show private key" to see it; each row has its own copy button. Press "Clear everything" when you are done.
Notes and limits
- Keys are not saved. They are gone when you close the page, so keep a new private key somewhere safe yourself (for example a password manager). A lost private key cannot be recovered by anyone.
- Supported formats are nsec, npub and 64-character hex. Other NIP-19 types (note, nprofile, nevent and so on) and mnemonic seed phrases (NIP-06) are not supported.
- This page loads no analytics or ad scripts and does not record your input. Even so, handle private keys only on a device you trust.
How it works
Key math uses the audited open-source library @noble/curves (secp256k1, BIP-340 Schnorr), and NIP-19 bech32 conversion uses @scure/base (both MIT licensed).
Private keys come from the browser's cryptographic random number generator (crypto.getRandomValues). Public keys are the 32-byte x-only keys defined in BIP-340.
Input checks: a private key must be at least 1 and below the secp256k1 group order; a public key must be the x coordinate of a point on the curve; bech32 input must have a valid checksum and the right prefix (nsec or npub).
A QR code is made for the public key (npub) only, never for the private key.
FAQ
Is my private key (nsec) sent anywhere?
No. Everything is calculated in your browser. Keys are not sent to a server, saved in the browser or put in the URL.
What is the difference between npub and a hex public key?
They are two ways to write the same 32 bytes. npub is the NIP-19 format and has a checksum, so typos are caught. Hex is what relays and the protocol use internally.
It says the checksum does not match.
At least one character of the nsec or npub is wrong, or it is cut off. Copy it again.
Which key can I share?
The public key (npub). Anyone who knows the private key (nsec) can post as you.
Related tools
Last updated: