AES guide / Modern encryption

AES-GCM Encryption and Decryption Guide

AES-GCM is a modern authenticated-encryption mode. It protects the confidentiality of a message and detects changes to its ciphertext when the key and nonce are correct.

Try it locally

Use the AES workspace to test documented values in your browser. Do not paste long-lived production secrets into a tool unless you understand and accept your device and browser risks.

Open the AES tool

Why use AES-GCM?

AES alone is a block cipher; it needs a mode of operation to encrypt a message. GCM adds authentication, so a changed ciphertext, nonce, or authentication tag causes decryption to fail. This is safer than treating successful decryption as proof that a message was not changed.

Choose the right values

Use a 16-byte key for AES-128, 24 bytes for AES-192, or 32 bytes for AES-256. For GCM, use a fresh 12-byte nonce for every encryption performed with the same key. Never reuse a nonce with the same key, because doing so can expose message data and weaken authentication.

Move ciphertext between systems

This tool appends GCM's 16-byte authentication tag to the encrypted output, which is the format used by the Web Crypto API. When another library provides the ciphertext and tag separately, combine them as ciphertext followed by tag before importing the result here. Record whether each value is UTF-8, Hex, or Base64.

Quick checklist

  1. Choose AES-GCM and the matching AES key size.
  2. Use a unique 12-byte nonce and keep it with the ciphertext; it is not secret.
  3. Save the Base64 or Hex encrypted output, including its authentication tag.

Common questions

Is a GCM nonce secret?

No. It can travel with the ciphertext, but it must not be reused with the same AES key.

What is the authentication tag?

It is extra data that lets the recipient detect changes and a wrong key or nonce. This tool includes it in the encrypted output.