Skip to main content
SK

SSH Key Generator

Generate a real RSA-2048 SSH key pair entirely in your browser — public key in OpenSSH format, private key as a PKCS#8 PEM.

Did you like the tool? Thanks!
Share:

Generates a real RSA-2048 key pair entirely inside your browser using the Web Crypto API. Nothing you generate here is ever sent to a server.

Generating a 2048-bit RSA key can take a moment, especially on slower devices — the tab will stay responsive while it works.

This key pair is generated and stays entirely inside your browser tab — it is never transmitted anywhere. Even so, treat any private key produced on a shared or public computer as compromised, since anything typed or copied on that device could be exposed. For real production servers, use the standard, independently audited ssh-keygen tool rather than a browser-based generator like this one — treat this as a convenience or demo generator, not a replacement. Note also that only RSA-2048 is offered here; Ed25519 key generation is not implemented because browser support for it in the Web Crypto API is still inconsistent.

How to Use SSH Key Generator

Click generate and your browser creates a genuine 2048-bit RSA key pair using the Web Crypto API. The public key is formatted the way ssh-copy-id and authorized_keys files expect it ("ssh-rsa AAAA... comment"), and the private key is exported as a standard PKCS#8 PEM block. Both come with their own copy button, and nothing you generate is ever sent anywhere — the whole process runs locally in the page.

About SSH Key Generator

SSH key pairs are the standard way to authenticate to a remote server without typing a password every time. A key pair consists of two mathematically linked files: a public key, which you upload to a server's authorized_keys list or paste into a hosting provider's dashboard (GitHub, GitLab, a cloud VPS, etc.), and a private key, which stays on your machine and is used to prove your identity whenever you connect. Because the two are linked by the mathematics of RSA, the server can verify you hold the private key without that key ever leaving your device or being sent over the network. This tool generates that pair the same way a browser would generate any other cryptographic key — through the Web Crypto API's crypto.subtle.generateKey() call, which is implemented natively by the browser, not by any JavaScript on this page. That means the actual key generation, including the random number generation that makes the key unguessable, uses the browser's own cryptographically secure random source rather than anything written for this widget. What this widget does add is the formatting: browsers export keys in generic formats (SPKI for public keys, PKCS#8 for private keys) rather than the OpenSSH-specific formats that tools like ssh-keygen, ssh-copy-id and most servers expect, so this tool parses the exported public key bytes and re-encodes them into the OpenSSH wire format by hand, and wraps the exported private key bytes into a standard PEM block. The public key format used by OpenSSH is a compact binary encoding: the string "ssh-rsa", the public exponent, and the modulus, each prefixed with its length and concatenated, then the whole thing is base64-encoded and given a human-readable prefix and an optional trailing comment (typically an identifier like a username and hostname, purely for your own reference — the comment carries no cryptographic weight and can be anything, or left blank). This tool lets you set that comment before generating. A couple of scope notes worth being upfront about. First, this generates RSA-2048 keys only — no Ed25519 option is offered, because as of now Ed25519 support inside the Web Crypto API is not consistently available across browsers, and building a hand-rolled Ed25519 implementation in JavaScript to work around that would be a much larger undertaking with a correspondingly larger risk of a subtle bug undermining the whole point of the tool. RSA-2048 remains a widely accepted, well-supported key size and algorithm for SSH authentication, so this is a reasonable default even if it is not the newest option available. Second, while everything genuinely runs client-side and nothing is transmitted, a browser tab is still not the same trust boundary as a purpose-built, security-audited command-line tool. For any key you will actually use to access production infrastructure, ssh-keygen (bundled with OpenSSH) remains the standard choice, is available on effectively every Linux, macOS and modern Windows install, and has been scrutinised far more thoroughly over a much longer period. Treat this generator as a fast, convenient way to produce a working key pair for testing, learning, or a throwaway scenario — not as a wholesale replacement for your existing key management workflow.

Details & Tips

How it works, step by step: 1. Your browser calls crypto.subtle.generateKey() to create an RSA-2048 key pair with a SHA-256 signing hash and the standard 65537 public exponent — this is the browser's own implementation, not custom code. 2. The public key is exported in SPKI (SubjectPublicKeyInfo) format, which is a DER-encoded ASN.1 structure. This tool parses that structure by hand — reading the SEQUENCE and INTEGER tags to pull out the raw RSA modulus and exponent — and re-encodes them using the OpenSSH wire format: a length-prefixed "ssh-rsa" string followed by the length-prefixed exponent and modulus, base64-encoded as a whole. This is the exact format used in ~/.ssh/authorized_keys files and by ssh-keygen -y. 3. The private key is exported in PKCS#8 format (an ArrayBuffer of raw bytes), base64-encoded, wrapped at 64 characters per line, and framed with the standard -----BEGIN PRIVATE KEY----- / -----END PRIVATE KEY----- markers. 4. Both keys are held only in the page's memory (as Alpine.js component state) until you copy them or navigate away — refreshing the page discards them, and there is no server round trip at any point. Using the generated key pair: paste the public key block into your server's ~/.ssh/authorized_keys file (or your Git hosting provider's SSH key settings), and save the private key block to a local file such as ~/.ssh/id_rsa with restrictive permissions (chmod 600 on Linux/macOS). Most SSH clients expect the private key filename to have no extension and the matching public key alongside it as filename.pub, though the exact convention depends on your client configuration. Why generate it in the browser at all, given the ssh-keygen caveat above? It is genuinely useful for quick, disposable scenarios — spinning up a one-off test VM, demonstrating how SSH key auth works in a classroom or tutorial setting, or generating a key on a machine where you don't want to touch the system's SSH configuration or don't have a terminal handy. For anything long-lived or production-facing, generate the key with ssh-keygen -t rsa -b 2048 (or -t ed25519 for a smaller, modern alternative) instead, and consider adding a passphrase, which this browser-based tool does not currently support encrypting the private key with.

Frequently Asked Questions

Is this a real SSH key, usable on an actual server?
Yes. The key pair is generated by your browser's native Web Crypto API (the same cryptographic engine used for HTTPS and other secure browser features), producing a genuine RSA-2048 key pair. The public key is re-encoded into the standard OpenSSH format and the private key into PKCS#8 PEM, so both can be used with real SSH servers and clients.
Is my private key sent to a server?
No. Key generation, formatting, and display all happen inside your browser tab using JavaScript running on your device. Nothing is transmitted, logged, or stored anywhere by this tool.
Why is there no Ed25519 option?
Ed25519 support in the Web Crypto API is still inconsistent across browsers as of now, so this tool sticks to RSA-2048, which is broadly supported and still a widely accepted choice for SSH authentication. If you specifically need Ed25519, generate it locally with ssh-keygen -t ed25519.
Can I add a passphrase to the private key?
Not with this tool — the private key is exported unencrypted. If you need a passphrase-protected key, generate it with ssh-keygen and supply a passphrase when prompted, or encrypt this key afterwards with a local tool such as openssl or ssh-keygen -p.
How do I add the public key to a server?
Copy the public key line and append it to ~/.ssh/authorized_keys on the target server (one key per line), or paste it into your Git hosting provider's SSH key settings page (GitHub, GitLab, Bitbucket, etc.).
How do I use the private key with an SSH client?
Save the private key block to a file such as ~/.ssh/id_rsa, restrict its permissions (chmod 600 on Linux/macOS), and reference it with ssh -i path/to/key or your SSH client's key configuration.
What does the "comment" field do?
It is appended to the end of the public key line purely for your own reference — commonly something like user@hostname — so you can identify which key is which later. It has no cryptographic significance and can be left blank or changed.
Why does key generation take a moment?
Generating a 2048-bit RSA key involves finding large prime numbers, which is computationally heavier than most everyday browser tasks. It typically takes well under a second on modern hardware but can take longer on slower devices — the loading indicator reflects this.
Should I use this for production servers?
For genuinely important, long-lived infrastructure, the standard, independently audited ssh-keygen command-line tool is the safer and more conventional choice. Treat this generator as a convenient option for testing, learning, and short-lived use cases.
Why is the private key format PKCS#8 rather than the older OpenSSH or PEM RSA format?
PKCS#8 is what the Web Crypto API exports natively, and it is a well-supported, standard format accepted by OpenSSL and most modern SSH clients. If you need the older "BEGIN RSA PRIVATE KEY" format specifically, you can convert it locally with openssl pkcs8 -traditional.
Does refreshing the page save my generated keys?
No. The keys exist only in the page's memory for as long as the tab stays open on this generation. Copy or save them before navigating away or refreshing, as there is no history or storage of previously generated keys.
Can I generate multiple key pairs in a row?
Yes, click generate again at any time — each click produces a completely new, independent key pair and replaces the one currently shown.

Part of These Collections

Also Available As

ssh key generator online, generate ssh key pair, rsa key generator, openssh public key generator, pkcs8 private key, ssh-keygen alternative online

Found a Problem?

Let us know if something with SSH Key Generator isn't working as expected.

Thanks — we'll take a look.