Skip to main content

Encrypt and Decrypt with RSA Keys in Your Browser Encrypt and decrypt using RSA public-key cryptography.

RSA Encrypt/Decrypt illustration
🔐

RSA Encrypt/Decrypt

Encrypt and decrypt using RSA public-key cryptography.

1

Enter Keys and Plaintext

Paste your RSA public/private key and the text to encrypt or decrypt.

2

Encrypt or Decrypt

Click Encrypt or Decrypt. Results appear in real time.

3

Copy Output

Copy the ciphertext or decrypted plaintext as needed.

Loading tool...

What Is RSA Encrypt/Decrypt?

RSA Encrypt/Decrypt is a cryptographic tool that enables users to securely encrypt and decrypt data using the RSA algorithm with public key encryption, specifically utilizing the RSA-OAEP protocol via the Web Crypto API. Developers who need to protect sensitive information, such as financial or personal data, use it to ensure confidentiality and authenticity of their data. One specific problem it solves is securing small amounts of data, like encryption keys or authentication tokens, where max plaintext size is around 190 bytes for a 2048-bit key with SHA-256 hashing.

It supports both RSA encrypt and decrypt operations, allowing users to switch between modes seamlessly. What makes this tool different is its ability to handle RSA encryption online directly in the browser, using the Web Crypto API to import keys in PEM format and perform cryptographic operations. The tool also provides features like automatic base64 encoding of encrypted data and decoding of input ciphertext.

The use of public key encryption with RSA-OAEP ensures semantic security, making it suitable for applications where data confidentiality is crucial. For larger datasets, developers can combine this tool with hybrid encryption methods to achieve efficient and secure data protection. It processes inputs in PEM format for keys and supports copying the output to the clipboard, streamlining the development workflow when working with RSA encrypt and decrypt operations.

Why Use RSA Encrypt/Decrypt?

  • Fast RSA encryption and decryption in the browser
  • 100% client-side — data never leaves your browser
  • Free online tool with no signup required
  • Mobile-friendly with 44px touch targets

Common Use Cases

Development

Use in software development workflows.

Security

Cryptographic and security applications.

Education

Learn about algorithms and techniques.

Verification

Verify and validate data integrity.

Technical Guide

The tool uses the RSA-OAEP protocol to perform encryption and decryption operations, relying on the Web Crypto API for cryptographic functions. Under the hood, it utilizes the `window.crypto.subtle` interface to import keys in PEM format and execute encryption and decryption processes. The key importing process involves converting the PEM string to an ArrayBuffer using base64 decoding and then passing it to the `importKey` method. For encryption, the tool uses the `RSA-OAEP` algorithm with a hash function of `SHA-256`, while for decryption, it employs the same algorithm but imports the private key in PKCS#8 format.

When processing input data, the tool encodes plain text into a Uint8Array using the `TextEncoder` API and then passes it to the `encrypt` method. The encrypted result is then converted to a base64-encoded string using the `btoa` function. Conversely, when decrypting ciphertext, the tool converts the base64 input string back to a Uint8Array and then uses the `decrypt` method to obtain the original plain text. Error handling is also implemented, catching any exceptions that occur during the encryption or decryption process and displaying an error message to the user.

The RSA-OAEP protocol itself adds randomized padding to the input data using the MGF1 mask generation function and SHA-256 hashing, ensuring IND-CCA2 security. The maximum plaintext size that can be encrypted is determined by the key length minus twice the hash length minus two, which for a 2048-bit key with SHA-256 hashing works out to around 190 bytes. By using the Web Crypto API and following established cryptographic protocols, the tool provides a secure and reliable means of performing RSA encryption and decryption operations directly in the browser. The use of specific technologies like React and TypeScript also ensures that the tool is maintainable and efficient.

Tips & Best Practices

  • 1
    All processing happens in your browser
  • 2
    Results are deterministic for the same input
  • 3
    Use Copy button to quickly grab output
  • 4
    Works on mobile devices with touch-friendly interface

Related Tools

Frequently Asked Questions

Q Is this tool free?
Yes, completely free with no signup required.
Q Is my data secure?
Yes. All processing is 100% client-side.
Q Does it work on mobile?
Yes, with responsive design and touch-friendly controls.
Q What browsers are supported?
All modern browsers including Chrome, Firefox, Safari, and Edge.
Q Can I use this offline?
The tool requires an initial page load but processes data locally.

About This Tool

RSA Encrypt/Decrypt is a free online tool by FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration or installation required.