πŸ”‘

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.

Security
Loading tool...

How 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

  1. 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
  2. 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
  3. 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
  4. 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:

  1. Generate 2048-bit or 4096-bit key pair
  2. Save private key as ~/.ssh/id_rsa
  3. Set permissions: chmod 600 ~/.ssh/id_rsa
  4. Add public key to server ~/.ssh/authorized_keys
  5. 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:

  1. Generate RSA key pair (2048-bit minimum)
  2. Create Certificate Signing Request (CSR)
  3. Submit CSR to Certificate Authority (CA)
  4. CA validates and issues certificate
  5. 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:

  1. Generate 3072-bit or 4096-bit key pair
  2. Import keys into email client or GPG
  3. Publish public key to key servers
  4. Share public key with contacts
  5. Encrypt emails with recipient's public key
  6. 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:

  1. Generate 3072-bit or 4096-bit key pair
  2. Sign compiled software/packages
  3. Distribute software + signature
  4. Users verify signature with your public key
  5. 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:

  1. Generate new key pair
  2. Deploy new public key
  3. Update all systems/services
  4. Test with new keys
  5. Revoke old keys
  6. 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:

  1. Wrong format: System expects different format (e.g., SSH format)
  2. Wrong permissions: File permissions too open
  3. Wrong location: Key not in expected directory
  4. 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: openssl command
  • 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 CaseRecommended SizeAlternative
SSH authentication2048-bit4096-bit
SSL/TLS certificates2048-bit3072-bit
Email encryption (PGP)3072-bit4096-bit
Code signing3072-bit4096-bit
File encryption4096-bit3072-bit
API authentication2048-bit3072-bit
Legacy compatibility1024-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

Share Your Feedback

Help us improve this tool by sharing your experience

We will only use this to follow up on your feedback