.pub

What is a .pub file?

PUB files contain an SSH or GPG public key — safe to share, used for authentication and encryption.

Safe format
Type Security
By OpenSSH / IETF
MIME text/plain

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

A .pub file is the public half of an asymmetric key pair. In SSH, it's the key you add to `~/.ssh/authorized_keys` on servers you want to access. In GPG, it's the key you share so others can encrypt messages to you. The public key is, by design, safe to share with anyone — it's the lock, not the key.

SSH public keys are a single line of text: the algorithm (ssh-rsa, ssh-ed25519), the key data in Base64, and an optional comment (usually your email). The corresponding private key lives in a file without the .pub extension (e.g., `id_ed25519` and `id_ed25519.pub`). Never share the file without .pub.

To generate an SSH key pair: `ssh-keygen -t ed25519 -C "[email protected]"`. This creates both the private key and the .pub file. Copy the .pub content to GitHub (Settings → SSH Keys), your server's authorized_keys, or wherever you need passwordless authentication.

Technical details
Full Name
Public Key File
MIME Type
text/plain
Developer
OpenSSH / IETF
Magic Bytes
N/A
Safety
.pub is a known, safe format. Public keys are designed to be shared. They cannot be used to impersonate you — only to verify your identity or encrypt data for you.
What opens it
Any text editor
FREE Windows / Mac / Linux
ssh-keygen (CLI)
FREE Windows / Mac / Linux
FAQ
Is it safe to share my .pub file?
Yes — that's exactly what it's for. Public keys are designed to be shared. They can verify your identity and encrypt data for you, but cannot be used to impersonate you or decrypt your data.
Where do I put my SSH public key?
On the remote server: append it to ~/.ssh/authorized_keys. On GitHub: Settings → SSH and GPG Keys → New SSH Key. On GitLab: Settings → SSH Keys.
Related formats