RSA Key Generator
Generate secure RSA public/private key pairs for encryption, digital signatures, and authentication. Create 1024 to 4096-bit RSA keys instantly in your browser.
SecurityHow to Use RSA Key Generator
How to Use RSA Key Generator
Getting Started
RSA (Rivest-Shamir-Adleman) is an asymmetric cryptographic algorithm that uses a pair of keys: a public key for encryption and a private key for decryption. This tool generates secure RSA key pairs entirely in your browser.
Basic Key Generation
-
Select Key Size: Choose the bit length for your keys
- 1024-bit: Legacy only - NOT recommended (weak security)
- 2048-bit: Standard minimum - good for most applications β
- 3072-bit: Enhanced security - recommended for sensitive data β
- 4096-bit: Maximum security - long-term protection β
- Larger keys = stronger security but slower generation
-
Click Generate: Create your key pair
- Button shows: "Generate [size]-bit RSA Key Pair"
- Generation takes 1-8 seconds depending on key size
- Progress indicator shows generation in progress
- All processing happens in your browser
-
View Generated Keys: Keys appear in separate tabs
- Public Key tab: Safe to share openly
- Private Key tab: Must keep secret
- Keys displayed in PEM format
- Each key shows in monospace font for clarity
-
Copy or Download Keys: Save your keys securely
- Copy button: Copy key to clipboard
- Download button: Save as .pem file
- Public key: Can share via email, websites, etc.
- Private key: Store securely, never share
Features
Multiple Key Sizes
1024-bit (NOT Recommended):
- Security: Weak - deprecated
- Use case: Legacy system compatibility only
- Generation: < 1 second
- Status: Vulnerable to modern attacks
- Recommendation: Avoid for new systems
2048-bit (Standard):
- Security: Good - industry minimum
- Use case: SSH, SSL/TLS, standard applications
- Generation: 1-2 seconds
- Status: Current standard for most uses
- Recommendation: Minimum for new systems β
3072-bit (Enhanced):
- Security: Strong - enhanced protection
- Use case: Sensitive data, email encryption, code signing
- Generation: 2-4 seconds
- Status: Recommended for important data
- Recommendation: Good balance of security and performance β
4096-bit (Maximum):
- Security: Very Strong - maximum protection
- Use case: Long-term secrets, critical infrastructure
- Generation: 4-8 seconds
- Status: Highest security available
- Recommendation: Best for critical applications β
Real-Time Generation Feedback
Progress Indicator:
- Loading animation during generation
- Button disabled while processing
- Clear status messages
- Prevents accidental double-generation
Generation Time Display:
- Shows actual time taken to generate
- Displayed in seconds (e.g., "2.34 seconds")
- Helps understand performance impact
- Varies based on device and key size
Success Confirmation:
- Green alert when generation completes
- Shows generation time
- Confirms keys are ready to use
Tabbed Key Display
Public Key Tab:
- Clearly labeled "Share Freely"
- Safe to distribute publicly
- Use for encryption and signature verification
- No security risk if exposed
Private Key Tab:
- Labeled with lock icon and "Keep Secret!"
- Red warning about privacy
- Must be protected at all costs
- Losing this means losing access to encrypted data
Both Tabs Include:
- Copy to clipboard button
- Download as file button
- Read-only text area
- Monospace font for clarity
Copy & Download Functionality
Copy to Clipboard:
- One-click copy operation
- Visual confirmation ("Copied!")
- Separate buttons for public and private keys
- Confirmation disappears after 2 seconds
Download as Files:
- Public key:
public_key_[size].pem - Private key:
private_key_[size].pem - PEM format (standard text format)
- Compatible with SSH, OpenSSL, most tools
Privacy & Security
Client-Side Generation:
- All key generation in browser
- No network requests made
- No server communication
- Complete privacy guaranteed
No Storage:
- Keys not saved anywhere
- Not logged or recorded
- Exist only in your browser session
- Cleared when you close/refresh page
Secure Random Generation:
- Uses cryptographically secure random number generator
- High-quality entropy
- Industry-standard algorithms
- Follows PKCS#1 standards
Understanding RSA Keys
How RSA Works
Asymmetric Encryption:
- Two related but different keys
- Public key encrypts, private key decrypts
- Mathematically linked but computationally infeasible to derive one from the other
- Based on difficulty of factoring large prime numbers
Public Key:
- Derived from two large prime numbers
- Can be shared freely and openly
- Used by others to encrypt messages to you
- Used to verify your digital signatures
- No security risk if compromised
Private Key:
- Contains the prime factors
- Must be kept absolutely secret
- Used to decrypt messages encrypted with public key
- Used to create digital signatures
- Complete security compromise if exposed
Mathematical Foundation:
- Choose two large prime numbers (p and q)
- Compute n = p Γ q (modulus)
- Compute Ο(n) = (p-1)(q-1)
- Choose e (public exponent, usually 65537)
- Compute d (private exponent, inverse of e mod Ο(n))
- Public key: (n, e)
- Private key: (n, d)
Security Strength
Key Size vs Security:
1024-bit:
- ~80 bits of security
- Factored in research settings
- Not secure for sensitive data
- Deprecated by most standards
2048-bit:
- ~112 bits of security
- Safe until at least 2030
- Current industry standard
- Resistant to known attacks
3072-bit:
- ~128 bits of security
- Safe for several decades
- Equivalent to AES-128
- Recommended for long-term data
4096-bit:
- ~140 bits of security
- Safe for foreseeable future
- Maximum practical strength
- Best for critical applications
Attack Complexity:
- Brute force: Try all possible keys (impossible)
- Factoring: Find prime factors of modulus (very hard)
- 2048-bit: Approximately 10^617 operations to factor
- Best known algorithm: General Number Field Sieve
- Current record: 829-bit RSA factored (much smaller than 2048)
Use Cases by Key Size
SSH Authentication (2048-bit minimum):
- Remote server login
- Git repository access
- Automated scripts
- DevOps pipelines
SSL/TLS Certificates (2048-bit minimum):
- HTTPS websites
- API endpoints
- Email servers
- VPN connections
Email Encryption (3072-bit recommended):
- PGP/GPG encrypted email
- S/MIME certificates
- Confidential communications
- Privacy protection
Code Signing (3072-bit recommended):
- Software distribution
- App signing (iOS, Android)
- Package managers
- Document verification
File Encryption (4096-bit recommended):
- Sensitive documents
- Database encryption
- Backup protection
- Long-term storage
Common Use Cases
SSH Key Authentication
Setup Process:
- Generate 2048-bit or 4096-bit key pair
- Save private key as
~/.ssh/id_rsa - Set permissions:
chmod 600 ~/.ssh/id_rsa - Add public key to server
~/.ssh/authorized_keys - SSH without password:
ssh user@server
Benefits:
- More secure than passwords
- No password to remember or type
- Can be automated in scripts
- Easy to revoke (remove from authorized_keys)
Best Practices:
- Use 2048-bit minimum (4096-bit better)
- Protect private key with passphrase
- Use ssh-agent to cache passphrase
- Different keys for different servers/purposes
SSL/TLS Certificate Creation
Certificate Workflow:
- Generate RSA key pair (2048-bit minimum)
- Create Certificate Signing Request (CSR)
- Submit CSR to Certificate Authority (CA)
- CA validates and issues certificate
- Install certificate and private key on server
Self-Signed Certificates:
- For development/testing only
- Generate key pair with this tool
- Use OpenSSL to create self-signed cert
- Not trusted by browsers (warning shown)
- Free but no validation
Production Certificates:
- Use CA like Let's Encrypt, DigiCert
- Browsers trust these CAs
- Validates domain ownership
- Required for public websites
Email Encryption (PGP/GPG)
Setup for Encrypted Email:
- Generate 3072-bit or 4096-bit key pair
- Import keys into email client or GPG
- Publish public key to key servers
- Share public key with contacts
- Encrypt emails with recipient's public key
- Decrypt received emails with your private key
Key Servers:
- keys.openpgp.org
- keyserver.ubuntu.com
- pgp.mit.edu
- Allow others to find your public key
Email Privacy:
- Encrypts email content (not metadata)
- Recipient needs your public key to verify
- You need recipient's public key to encrypt
- Popular with privacy-conscious users
Code Signing
Software Distribution:
- Generate 3072-bit or 4096-bit key pair
- Sign compiled software/packages
- Distribute software + signature
- Users verify signature with your public key
- Confirms software not tampered with
Package Managers:
- npm: Sign packages with GPG key
- PyPI: Sign Python packages
- APT/YUM: Sign Linux packages
- App stores: iOS/Android code signing
Trust & Verification:
- Proves you created the software
- Detects unauthorized modifications
- Essential for security software
- Required by many platforms
Security Best Practices
Private Key Protection
File Permissions:
chmod 600 private_key.pem # Owner read/write only
chmod 400 private_key.pem # Owner read only (even safer)
Passphrase Protection:
- Encrypt private key with passphrase
- Use strong, unique passphrase
- Store passphrase in password manager
- Adds layer of protection if key stolen
Secure Storage Locations:
- β Encrypted USB drive (offline backup)
- β Hardware security module (HSM)
- β Password manager (encrypted vault)
- β Encrypted home directory
- β Cloud storage (unless encrypted)
- β Email or messaging apps
- β Public repositories
- β Unencrypted USB drives
Access Control:
- Limit who can access private key
- Use separate keys for different purposes
- Monitor key usage (logs)
- Revoke compromised keys immediately
Public Key Distribution
Safe Distribution Methods:
- Post on personal website
- Add to GitHub/GitLab profile
- Upload to key servers (PGP)
- Include in email signature
- Share via HTTPS
- Print on business card
Key Fingerprints:
- Short hash of public key
- Verify key authenticity
- Share fingerprint separately from key
- Prevents key substitution attacks
Key Verification:
- Verify fingerprint matches
- Check through multiple channels
- Meet in person to verify (best)
- Use web of trust (PGP)
Key Rotation
When to Rotate Keys:
- Annually for high-security systems
- After employee departure
- Suspected compromise
- Algorithm or key size deprecated
- Compliance requirements
Rotation Process:
- Generate new key pair
- Deploy new public key
- Update all systems/services
- Test with new keys
- Revoke old keys
- Archive old keys securely (for old data)
Overlapping Period:
- Keep old keys active during transition
- Support both old and new keys
- Gradual migration
- Minimize service disruption
Key Backup Strategy
3-2-1 Backup Rule:
- 3 copies of keys
- 2 different storage media
- 1 offsite backup
Backup Locations:
- Primary: Encrypted local storage
- Secondary: Encrypted USB in safe
- Tertiary: Encrypted cloud backup or bank deposit box
Testing Backups:
- Regularly verify backups work
- Test restoration process
- Ensure backups are accessible
- Update backups after key rotation
Troubleshooting
Key Generation Too Slow
Problem: 4096-bit keys taking too long
Solutions:
- Use 3072-bit instead (still very secure)
- Close other browser tabs
- Try different browser (Chrome/Firefox often faster)
- Wait patiently - security takes time
- Consider 2048-bit for non-critical uses
Cannot Use Generated Keys
Problem: Keys not accepted by system
Possible Causes:
- Wrong format: System expects different format (e.g., SSH format)
- Wrong permissions: File permissions too open
- Wrong location: Key not in expected directory
- Wrong encoding: Line ending or encoding issues
Solutions:
- Convert PEM to required format (e.g., OpenSSH)
- Set correct permissions:
chmod 600 keyfile - Move to correct location (e.g.,
~/.ssh/) - Check file encoding (should be UTF-8, LF line endings)
Format Conversion:
# PEM to OpenSSH format
ssh-keygen -i -f public_key.pem > id_rsa.pub
# Add passphrase to private key
ssh-keygen -p -f private_key.pem
Key Format Compatibility
Different Key Formats:
- PEM: This tool's output - widely compatible
- OpenSSH: Used by SSH (can convert from PEM)
- PKCS#1: Traditional RSA format
- PKCS#8: Modern private key format
- DER: Binary encoding (vs PEM text)
Conversion Tools:
- OpenSSL:
opensslcommand - ssh-keygen: SSH key conversion
- Online converters (less secure)
- Programming libraries
Advanced Topics
RSA vs Other Algorithms
RSA vs DSA:
- RSA: Encryption + signatures
- DSA: Signatures only (no encryption)
- RSA more versatile
- Both being replaced by elliptic curve
RSA vs Elliptic Curve (ECDSA/EdDSA):
- EC: Smaller keys, equal security (256-bit EC β 3072-bit RSA)
- EC: Faster operations
- RSA: More widely supported (legacy systems)
- RSA: Simpler to understand
- Future: Elliptic curve preferred for new systems
When to Use RSA:
- Legacy system compatibility
- Established infrastructure
- Well-understood security
- Wide tool support
When to Use Elliptic Curve:
- New systems
- Performance critical
- Limited storage/bandwidth
- Modern protocols
Key Formats Explained
PEM Format:
-----BEGIN PUBLIC KEY-----
Base64-encoded key data here
Multiple lines
-----END PUBLIC KEY-----
- Text-based, human-readable
- Base64 encoding of binary data
- Headers indicate key type
- Most common format
PKCS#1 vs PKCS#8:
- PKCS#1: RSA-specific format
- PKCS#8: Generic private key format
- PKCS#8 preferred for modern systems
- Both supported by most tools
Quantum Computing Impact
Future Threat:
- Quantum computers can break RSA
- Shor's algorithm factors numbers efficiently
- Timeline: 10-30 years (uncertain)
- Not a current practical threat
Post-Quantum Cryptography:
- NIST standardizing quantum-resistant algorithms
- Lattice-based cryptography
- Hash-based signatures
- Code-based cryptography
Recommendations:
- RSA still secure for now
- Plan for eventual migration
- Monitor PQC standardization
- Use longer keys (4096-bit) for long-term data
Quick Reference
Key Size Selection Guide
| Use Case | Recommended Size | Alternative |
|---|---|---|
| SSH authentication | 2048-bit | 4096-bit |
| SSL/TLS certificates | 2048-bit | 3072-bit |
| Email encryption (PGP) | 3072-bit | 4096-bit |
| Code signing | 3072-bit | 4096-bit |
| File encryption | 4096-bit | 3072-bit |
| API authentication | 2048-bit | 3072-bit |
| Legacy compatibility | 1024-bit* | 2048-bit |
*1024-bit NOT recommended - use only if absolutely required
Security Checklist
β Use 2048-bit minimum (3072-bit or 4096-bit for sensitive data) β Generate keys on trusted, secure device β Store private key with encryption and strict permissions β Backup private key in multiple secure locations β Never share or email private key β Use passphrase protection for private key β Share public key freely as needed β Rotate keys annually for high-security applications β Test key backups regularly β Revoke keys immediately if compromised
Common Commands
Set Private Key Permissions:
chmod 600 private_key.pem
Add Passphrase to Private Key:
ssh-keygen -p -f private_key.pem
View Public Key Fingerprint:
ssh-keygen -lf public_key.pem
Convert PEM to OpenSSH Format:
ssh-keygen -i -f public_key.pem > id_rsa.pub
Test SSH Key:
ssh -i private_key.pem user@server
Add Public Key to Server:
cat public_key.pem >> ~/.ssh/authorized_keys
Frequently Asked Questions
Related Utility Tools
Temperature Converter
FeaturedConvert temperatures between Celsius, Fahrenheit, and Kelvin instantly with live conversion
Use Tool βUnit Converter
FeaturedConvert between length, weight, and volume units instantly. Support for metric and imperial systems.
Use Tool βWord Counter
FeaturedCount words, characters, sentences, and reading time instantly
Use Tool βArea Converter
FeaturedConvert areas between square feet, square meters, acres, hectares, and square yards instantly
Use Tool βTime Zone Converter
FeaturedConvert between time zones and see current or custom time across different parts of the world
Use Tool βSpeed Converter
FeaturedConvert speeds between miles per hour (MPH), kilometers per hour (KPH), and knots instantly
Use Tool βMinify JavaScript
Minify and compress JavaScript code to reduce file size for production. Remove comments, whitespace, and optimize code for faster loading.
Use Tool βPaper Size Converter
Convert between international paper sizes (A4, Letter, Legal) with dimensions in mm, cm, and inches. Compare ISO A/B series and North American paper standards.
Use Tool βShare Your Feedback
Help us improve this tool by sharing your experience