RSA Key Generator & Encryption/Decryption Tool

100% Client-Side Implementation | RSA Algorithm | No Server Processing

Key Operations

Results Display

📖 View RSA Guide

RSA Online Tool - Complete Guide to RSA Algorithm & Implementation

📌 What is RSA?

RSA (Rivest-Shamir-Adleman) is an asymmetric cryptographic algorithm widely used for secure data transmission. Unlike symmetric encryption that uses a single key for both encryption and decryption, RSA uses a pair of mathematically linked keys: a public key (freely distributable) and a private key (kept secret). This fundamental difference makes RSA ideal for secure communication over insecure networks.

  • Asymmetric cryptography - separate keys for encryption and decryption
  • Based on the mathematical difficulty of factoring large prime numbers
  • Public key can be shared openly without compromising security
  • Private key must remain confidential to maintain security
  • Used in HTTPS, SSH, digital signatures, and secure email communication
  • 1024-bit RSA keys provide basic security, 2048-bit recommended for modern use

🔑 RSA Algorithm & Key Generation Principles

The RSA algorithm relies on number theory, specifically the difficulty of factoring the product of two large prime numbers. Here's how RSA keys are generated:

  1. Generate two distinct large prime numbers (p and q)
  2. Calculate modulus n = p × q (used in both public and private keys)
  3. Compute Euler's totient function φ(n) = (p-1) × (q-1)
  4. Choose public exponent e (typically 65537) that is coprime with φ(n)
  5. Calculate private exponent d as the modular inverse of e modulo φ(n)
  6. Public key consists of (e, n), private key consists of (d, n)
  7. Destroy p and q - their discovery would compromise the private key

This online RSA tool generates RSA keys using the browser's native Web Crypto API, ensuring all key generation happens locally on your device with no data sent to servers.

🔒 RSA Encryption & Decryption Process

RSA encryption and decryption follow these mathematical operations:

Public Key Encryption:

Given plaintext message m (converted to integer):

Ciphertext = me mod n

Private Key Decryption:

Given ciphertext c:

Plaintext = cd mod n

The security of RSA comes from the fact that calculating d from e and n is equivalent to factoring n into p and q - a computationally hard problem with large numbers.

📝 How to Use This RSA Online Tool

  1. Select key size (1024-bit for fast generation, 2048-bit recommended for security)
  2. Click "Generate RSA Key Pair" to create your public/private key pair
  3. Enter text in the input field (plaintext for encryption, Base64 ciphertext for decryption)
  4. Select operation type: Public Key Encryption or Private Key Decryption
  5. Click "Encrypt" or "Decrypt" to process your data
  6. Use copy buttons to save your keys and results

⚠️ Important Security Notes

  • 1024-bit RSA keys support ~117 UTF8 characters, 2048-bit supports ~245 characters per encryption
  • Always keep your private key secure - never share it with untrusted parties
  • Keys are stored only in browser memory - refresh will lose all generated keys
  • For decryption, ensure ciphertext is Base64 encoded and matches the private key
  • This RSA online tool is for educational purposes - use properly audited libraries for production
  • RSA is slow for large data - typically used to encrypt symmetric keys (hybrid encryption)