Secure Shell (SSH) keys are essential for logging into servers, Git platforms, and cloud services without using a password. Whether you’re a developer, system admin, or just someone working with GitHub, generating SSH keys on Windows is something you’ll eventually need to do.
If you’re here reading this guide, you probably want the easiest, safest, and most reliable methods to create SSH keys on your Windows 10 or Windows 11 PC. The good news? Windows now includes built-in tools for SSH key generation, and you can also use third-party applications if you prefer a graphical interface.
In this detailed guide, we’ll walk you through three simple ways to generate SSH keys on Windows, complete with step-by-step instructions.
1. Generate SSH Keys Using Windows PowerShell (Built-in Method)
Windows 10 and Windows 11 come with OpenSSH Client preinstalled, so you can generate SSH keys without installing anything extra.
Open PowerShell
- Press Windows + S.
- Type PowerShell.
- Click Run as administrator.
Run SSH Key Generation Command
Enter the following command:
ssh-keygen -t rsa -b 4096
This generates a 4096-bit RSA key, which is widely supported and secure.
You can replace RSA with other algorithms if needed:
- ed25519 → fastest and most secure modern algorithm
- ecdsa → lightweight, but slightly less preferred today
Example:
ssh-keygen -t ed25519
Choose Save Location
PowerShell will ask:
Enter file in which to save the key
Press Enter to save it in the default location:
C:\Users\<YourName>\.ssh\id_rsa
Set Passphrase (Optional but Recommended)
You’ll be prompted for a passphrase.
Choose one or press Enter to skip.
SSH Keys Created Successfully
Your generated keys include:
- Private key:
id_rsa - Public key:
id_rsa.pub
To view your public key:
cat ~/.ssh/id_rsa.pub
Copy this and add it to your server or GitHub account.
2. Generate SSH Keys Using Git Bash (Perfect for GitHub Users)
If you use Git for Windows, Git Bash includes its own SSH tools.
Install Git for Windows
Download from: https://git-scm.com/
Open Git Bash
Right-click your desktop → Git Bash Here.
Generate SSH Key
Run:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
The -C flag adds a label (comment) to your key.
Save the Key
Press Enter to store the key in:
/c/Users/<YourName>/.ssh/id_rsa
Add Passphrase
Then Git Bash will generate your keys.
Add SSH Key to SSH Agent
Start the SSH agent:
eval "$(ssh-agent -s)"
Add your private key:
ssh-add ~/.ssh/id_rsa
That’s it! Git Bash now uses your SSH key automatically.
3. Generate SSH Keys Using PuTTYgen (GUI Tool)
If you prefer a graphical interface, PuTTYgen is the most popular SSH key generator for Windows.
Download PuTTY
Get it from:
https://www.putty.org/
Install or download the standalone tools.
Open PuTTYgen
Open PuTTYgen from the Start menu.
Choose Key Type
Select:
- RSA (4096 bits)
- Or Ed25519 (recommended)
Set Number of bits in a generated key to:
4096
(if using RSA)
Generate the Key
Click Generate.
Move your mouse randomly over the window to create entropy.
Your key pair will now be generated.
Save Public & Private Keys
Click:
- Save public key
- Save private key (optionally add a passphrase)
PuTTY saves private keys in .ppk format, which works with all PuTTY-based tools.
Copy Public Key
At the top of PuTTYgen, select and copy the public key text.
Use this to configure SSH access on servers or Git platforms.
Wrapping Up
And that wraps up our detailed guide on 3 Ways to Generate SSH Keys on Windows. Whether you’re using PowerShell, Git Bash, or PuTTYgen, creating SSH keys on Windows is quick and straightforward. With your new keys ready, connecting securely to servers or Git repos becomes seamless.