Encrypt text with AES-GCM

Protect bytes with authenticated AES-GCM using a key, nonce, and optional associated data.

freeworks offlinenothing uploaded
ToolAES-GCM Encrypt
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

AES-GCM processes plaintext, authenticates additional data, and appends an authentication tag to ciphertext. Decryption needs the same key, nonce, tag, and associated data to verify integrity.

  • A 96-bit nonce and 128-bit tag are interoperable defaults.
  • Nonce uniqueness is required for each key.

Worked example

Encrypt Message
Encrypt a message with a password using AES-256-GCM
Input
											Input: Secret message for Bob
Key: MySecretKey123!
										
Output
												2hubVho1RqIg33AizwYg+hO+QkQ5zxm9oBZZKS1/N6mOn+OAyCbbGoODxiEfbGJPRpN1mpj6MdkqiJHOYqAbRV1o
											

When to use this

Database fields, Web Crypto storage, and authenticated protocol messages use GCM.

Edge cases

  • Nonce reuse undermines GCM security.
  • Changing associated data causes authentication failure.
  • An altered or truncated tag must reject the message.

References