Skip to content

AES Encryption and Decryption Online

Advanced Encryption Standard (AES) is a fast, secure symmetric encryption algorithm that transforms readable text into encrypted ciphertext using the same secret key for encryption and decryption. It supports 128-bit, 192-bit, and 256-bit keys and is widely used to protect files, databases, APIs, and communications.

Below is an online tool for AES encryption and decryption which supports multiple cipher modes - ECB, CBC, CTR, and GCM - with AES-256-GCM being the recommended choice. Learn more in this Java AES implementation guide.

AES Encryption

Turn plain text into ciphertext.

Cipher settings

Use random or PBKDF2-derived keys. Encoding won’t strengthen weak passwords.

This tool uses 16-byte IVs. Required for CBC, CTR, and GCM. Keep the same IV for decryption.

Text, keys and IVs are sent to the DevGlan server for processing.

AES Decryption

Turn ciphertext back into readable text.

Cipher settings

This tool uses 16-byte IVs. Required for CBC, CTR, and GCM. Keep the same IV for decryption.

Created by Dhiraj · Reviewed by the DevGlan Team

How to Use This AES Encryption Tool

  1. Enter your plain text in the Encrypt panel, or your ciphertext in the Decrypt panel.
  2. Choose a cipher mode - GCM is recommended for most use cases.
  3. Select a key size - AES-128, AES-192, or AES-256.
  4. Enter or generate a secret key using the Generate button. Keep this key safe - it is required for decryption.
  5. Enter or generate an IV (not needed for ECB mode). Use a random IV for each encryption.
  6. Click Encrypt or Decrypt and copy the output.

Key Features of AES Encryption

Symmetric Key Algorithm The same secret key is used for both encryption and decryption - making AES fast and efficient for bulk data.
Block Cipher AES operates on fixed-size blocks of 128 bits. Data is divided into 16-byte chunks before encryption.
Cipher Modes This tool supports four AES modes:
ECB, CBC, CTR & GCM - AES-GCM is recommended for authenticated encryption.
Flexible Key Sizes Supports 128-bit, 192-bit, and 256-bit encryption. AES-256 is trusted by governments and enterprises for high-security data.
Industry Standard Widely used in databases, file encryption, APIs, TLS/SSL, and cloud security worldwide.

AES Encryption Concepts

To encrypt data, enter the plain text or password and choose an appropriate AES mode of operation. Each mode offers different security and performance characteristics.

AES Modes of Operation Comparison

Mode IV Required by This Tool Padding Authentication Status
ECB No PKCS5 No Not Recommended
CBC Yes (16 bytes) PKCS5 No (add MAC) Acceptable
CTR Yes (16 bytes) None No (add MAC) Good
GCM Yes (16 bytes) None Yes (built-in) Recommended

ECB (Electronic Codebook) does not use an IV and produces identical ciphertext for identical plaintext blocks, making it insecure for real-world usage. CBC (Cipher Block Chaining) uses an Initialization Vector (IV) to randomize output - more secure than ECB but does not provide authentication. CTR (Counter Mode) turns AES into a stream cipher and allows parallel processing, making it suitable for high-performance systems. GCM (Galois/Counter Mode) provides authenticated encryption, ensuring confidentiality and integrity - the recommended mode for modern applications and APIs.

Padding

ECB and CBC require input in complete 16-byte blocks. PKCS5Padding adds padding, including a full padding block when input is already aligned. Use NoPadding only when input is already a multiple of 16 bytes. CTR and GCM use NoPadding and accept other input lengths.

AES Key Size and IV

AES always uses a 128-bit block size. This tool requires 16-byte (128-bit) IVs for CBC, CTR, and GCM. CBC uses a 16-byte IV; CTR uses a 16-byte initial counter block whose counter sequence must not repeat under the same key. GCM supports other nonce lengths, with 12 bytes (96 bits) recommended by NIST; this tool currently accepts 16 bytes. ECB does not use an IV. Secret key sizes must be 16, 24, or 32 bytes for AES-128, AES-192, and AES-256 respectively.

Encrypted output is Base64 encoded by default, with an option to export ciphertext in HEX format.

Common AES Encryption & Decryption Errors (and Fixes)

Wrong AES Mode Selected Using insecure or incorrect AES modes is the most common cause of weak encryption. AES-ECB leaks patterns and should never be used for real data - identical plaintext blocks produce identical ciphertext, revealing structure.

Fix: Use AES-GCM for authenticated encryption, or AES-CBC with a secure MAC if GCM is unavailable.

Invalid IV Length This tool requires a 16-byte (128-bit) IV for CBC, CTR, and GCM. Other applications may use a 12-byte GCM nonce; that length is not supported by this tool.

Fix: For encryption, enter a fresh 16-byte IV or use Generate IV. For decryption, use the original IV and its encoding.

Authentication Tag Verification Failed (AES-GCM) This error occurs when ciphertext or associated data is modified, or when the wrong key or IV is used during decryption.

Fix: Ensure the same key, IV, and associated data are used for both encryption and decryption.

Padding Errors (PKCS5Padding) Padding errors happen when decrypting data with mismatched padding or corrupted ciphertext.

Fix: Ensure the same padding scheme is used on both sides. Switch to AES-GCM to avoid padding-based modes entirely.

Secret Key Format

  • Secret Key must be provided in one of these formats: Hex / Base64 / Plain Text.
  • Key length must match the selected key size:
    • 128-bit → 16 bytes (e.g. 32 hex characters)
    • 192-bit → 24 bytes
    • 256-bit → 32 bytes
  • Example: 32 hex chars = 16 bytes (AES-128)

Using a plain-text password directly as an encryption key is not recommended. Human-readable passwords usually have low entropy and are vulnerable to brute-force and dictionary attacks.

For stronger security, derive a key from your password using PBKDF2 with a unique salt and an appropriate iteration count. Its output length is configurable: use 16, 24, or 32 bytes for AES-128, AES-192, or AES-256. Key strength still depends on the password and derivation settings. Use the PBKDF2 Hashing Online Tool to generate one.

IV Format and Security Concerns

  • IV can be Hex / Base64 / Plain Text.
  • In this tool, the IV must decode to exactly 16 bytes (128 bits):
    • 32 hex characters
    • or a Base64 string that decodes to 16 bytes
    • or 16 plain text bytes
  • IV is required for CBC, CTR, and GCM. Supply a random IV explicitly or use Generate IV.
  • If the IV is missing, this tool rejects CBC, CTR, and GCM requests. Enter an IV or click Generate IV before encryption, and retain it for decryption.
  • Without a random IV, identical plaintext encrypted with the same key produces identical ciphertext - this leaks information and weakens security.
  • Best practice: always use a random IV for CBC/CFB/GCM modes and never reuse an IV with the same key.

You can analyze insecure AES usage using our Crypto Safety Validator.

Secure Usage Guidelines for AES

  • Prefer AES-GCM for modern applications - it provides encryption and authentication in one operation
  • Never use AES-ECB for real data - it reveals patterns in identical plaintext blocks
  • Always use a random, unique IV for every encryption operation
  • Never reuse encryption keys or IVs across different systems or purposes
  • Use AES only for data encryption - not for password storage; use bcrypt, scrypt, or Argon2 instead

Security note: AES-GCM provides confidentiality and integrity in one pass. CBC and CTR modes require additional authentication (MAC) to prevent tampering.

MAC Generators: HMAC Generator · Poly1305 Generator

AES vs RSA vs DES

AES is a symmetric encryption algorithm designed for speed and efficiency. RSA is an asymmetric algorithm mainly used for secure key exchange and digital signatures, while DES is an outdated symmetric cipher and is no longer considered secure.

Feature AES RSA DES
Encryption Type Symmetric Asymmetric Symmetric
Performance Very fast Slow Fast but insecure
Key Size 128 / 192 / 256 bits 2048+ bits 56 bits
Security Status Highly secure Secure Broken / deprecated
Typical Usage Encrypting data Key exchange Legacy systems

In practice, AES is often used together with RSA encryption, where RSA secures the AES secret key and AES encrypts the actual data.

When NOT to Use AES

  • Password Storage: AES is reversible encryption and should never be used to store passwords. Use bcrypt, scrypt, or Argon2 instead.
  • Unauthenticated Encryption: Using ECB or CBC without integrity protection can allow data tampering. Prefer AES-GCM or MAC-based solutions like Poly1305.
  • Poor Key Management: Hardcoded keys, reused IVs, or weak randomness can compromise AES security entirely.
  • Public-Key Requirements: AES is not suitable for digital signatures or secure key exchange. Use RSA or elliptic-curve cryptography for these use cases.

Applications of AES Encryption

  • Data Protection: Encrypting sensitive files and database fields.
  • Secure Communication: HTTPS, SSL/TLS, and API payload encryption.
  • Authenticated Encryption: Used with MACs such as Poly1305 to ensure integrity.

Frequently Asked Questions (FAQ)

Yes. AES is considered highly secure when used with strong keys and modern modes like AES-GCM. AES-256 is widely trusted by governments and enterprises.
No. Passwords should be hashed using slow, memory-hard algorithms such as bcrypt, scrypt, or Argon2 instead of reversible encryption.
AES-GCM is the recommended choice as it provides encryption and authentication in a single, efficient operation.
There are no practical attacks against properly implemented AES. Most vulnerabilities arise from incorrect usage, weak keys, or poor key management.
AES-128 uses a 128-bit key (16 bytes) and performs 10 rounds of encryption. AES-256 uses a 256-bit key (32 bytes) and performs 14 rounds - providing a larger security margin at a small performance cost. Both are considered secure; AES-256 is preferred for high-security and long-lived data.
Yes. AES-GCM requires a nonce (IV) - typically 12 bytes (96 bits) for optimal performance, though this tool uses 16 bytes to stay consistent with other modes. The IV must be unique for every encryption with the same key. Reusing a nonce in GCM mode completely breaks its authentication guarantee.

❤️ Liked this tool?

If it saved you time, consider buying me a coffee to support future improvements.

Help Others Find This

References