Skip to content
⚠ TESTING ENVIRONMENT You are viewing a testing copy of Tolioo. Changes here do not affect the live website.

AES Encryption Demo

Encrypt and decrypt text or files with AES-256-GCM, CBC or CTR, and see every step: salt, IV, derived key, ciphertext and authentication tag. It runs in your browser, so nothing is uploaded.

  • 100% free
  • Nothing uploaded
  • AES-128 / 192 / 256
Text to encrypt

0 characters

Use the same format in your own code

                

These examples use the default settings (AES-256-GCM, password, PBKDF2-SHA256 with 600,000 iterations, Base64). We tested that they decrypt this tool's output and the other way around.

Verify the engine

Run the AES and PBKDF2 code in your browser against official test vectors from NIST and other published standards.

    ADVERTISEMENT
    Demo Ad 728 x 90
    AES ENCRYPTION GUIDE

    Free AES Encryption Demo – Encrypt and Decrypt Text and Files Online with AES-256-GCM, CBC and CTR

    AES, the Advanced Encryption Standard, is the encryption that protects most of the digital world. It secures your HTTPS connections, your Wi-Fi, your phone storage, your password manager, your cloud backups and the files on millions of laptops. Yet for most people, and even for many developers, it is a black box: you give it data and a key, and something unreadable comes out. Our free AES encryption demo opens that box. Type some text or choose a file, enter a password or your own hexadecimal key, pick AES-128, AES-192 or AES-256 and the mode GCM, CBC or CTR, and the tool encrypts or decrypts it right away. Then it shows you exactly what happened: the random salt, the key that PBKDF2 derived from your password, the initialization vector (IV), the ciphertext, the authentication tag and a color-coded picture of how these parts are packed together. You get an online AES encryption and decryption tool, a learning lab for students and a testing helper for developers, all in one page. Everything runs in your browser with the Web Crypto API, so your text, files and passwords are never uploaded. You can copy the result as Base64 or hex, decrypt it again, download encrypted files, run official NIST test vectors to verify the engine, and copy ready-to-use code for JavaScript, PHP and Python that works with the output of this tool.

    AES-128, 192 and 256

    Choose the key size and the mode: AES-GCM with built-in tamper detection, or classic CBC and CTR.

    See Every Step

    Inspect the salt, IV, derived key, ciphertext and tag, with a clear explanation of each step.

    Private by Design

    It all runs in your browser. Nothing you type or upload leaves your device.

    How to Encrypt and Decrypt with AES Online

    The tool is built so that a beginner can encrypt something in half a minute, and an expert can control every parameter.

    1. Choose Encrypt or Decrypt, and Text or File: To encrypt a message, keep Encrypt and Text selected. To protect a document or photo, switch to File.
    2. Enter your content: Type or paste the text, or pick a file of up to 25 MB.
    3. Pick the algorithm: AES-GCM is the best default because it encrypts and also checks that the data was not changed. Use CBC or CTR only when you need to match an existing system.
    4. Choose the key size: AES-256 is the strongest and the recommended choice. AES-128 and AES-192 are also considered secure.
    5. Set the key: Enter a strong password, and the tool turns it into a key with PBKDF2. Or switch to Raw key and enter your own hex key, or press Random to generate one.
    6. Click Encrypt: Copy the Base64 or hex result, or download the encrypted file with the .aes ending.
    7. Decrypt later: Paste the encrypted text or choose the .aes file, select the same algorithm, key size, key source and iterations, enter the same password, and click Decrypt.

    What Is AES Encryption?

    AES is a symmetric block cipher. Symmetric means that the same secret key is used to lock and to unlock the data, and block cipher means that it works on fixed blocks of 128 bits (16 bytes) at a time. It was created by the Belgian cryptographers Joan Daemen and Vincent Rijmen under the name Rijndael, was chosen by the US National Institute of Standards and Technology (NIST) after a public competition, and was published as the standard FIPS 197 in 2001. More than twenty years of worldwide analysis have found no practical attack against full AES, which is why it is trusted by governments, banks and every major technology company. The key can have three sizes: 128, 192 or 256 bits. The number of rounds of mixing inside the cipher grows with the key size: 10 rounds for AES-128, 12 for AES-192 and 14 for AES-256.

    How Does AES Work?

    AES takes a 16-byte block and arranges it in a 4 by 4 grid. First it mixes in a part of the key. Then, in every round, it performs four operations. SubBytes replaces each byte with another one using a fixed lookup table, which hides the relation between input and output. ShiftRows moves the bytes of each row by a different amount. MixColumns blends the four bytes of each column together, so that one changed input byte affects many output bytes. AddRoundKey combines the grid with a new round key that is calculated from your main key. After the last round, the grid is the encrypted block. This repeated substitution and mixing creates what cryptographers call confusion and diffusion, and it makes the output look like random data. Because AES only encrypts one block, a mode of operation such as GCM, CBC or CTR decides how to handle messages that are longer than 16 bytes, and that choice is just as important as the key size.

    AES Modes Compared: GCM, CBC, CTR and ECB

    The mode of operation defines how blocks are chained, and it decides whether your data is only hidden or also protected against changes.

    ModeAuthenticatedIV or nonceBest forWatch out for
    AES-GCMYes, 128-bit tag12 bytes, never reuse with the same keyAlmost everything: messages, files, APIs, TLSReusing a nonce destroys its security
    AES-CBCNo16 random bytesCompatibility with older systemsNeeds padding, and can be attacked without a MAC (padding oracles)
    AES-CTRNo16-byte counter blockStreaming and random accessAttackers can flip bits in the ciphertext unnoticed
    AES-ECBNoNoneNothing: avoid itIdentical blocks give identical output, which leaks patterns. This tool does not offer it.

    In short: use AES-GCM. It gives you confidentiality and integrity in one step. If decryption fails with AES-GCM, you know that the key was wrong or the data was modified, instead of getting garbage that looks like a valid result.

    AES-128 vs AES-192 vs AES-256

    Key sizeRoundsHex key lengthSecurity level
    AES-1281032 characters128-bit: out of reach of brute force
    AES-1921248 characters192-bit: very high margin
    AES-2561464 characters256-bit: highest margin, also considered resistant to future quantum attacks on key search

    For a practical attacker, all three sizes are far beyond brute force. Trying every 128-bit key would take longer than the age of the universe on any computer that exists. AES-256 is the usual choice because it costs almost nothing extra and gives the largest safety margin. In reality, a weak password or a leaked key is the weak point, not the key size.

    Password vs Raw Key: What Is PBKDF2?

    AES needs a key of exactly 128, 192 or 256 random bits, but people remember passwords, not random bits. A key derivation function (KDF) bridges the gap. This tool uses PBKDF2 with HMAC-SHA-256. It combines your password with a random 16-byte salt and repeats a hashing step hundreds of thousands of times, and the result is a key of the right size. The salt makes sure that two people with the same password get different keys, and the many iterations make every password guess slow for an attacker. A setting of 600,000 iterations follows the current OWASP guidance for PBKDF2-HMAC-SHA256. A stronger and slower option is available at 1,000,000. If you already have a random key from a secure generator, choose Raw key mode, and the tool uses it directly. A raw key must be exactly 32, 48 or 64 hex characters long, depending on the key size.

    What Is Inside the Encrypted Output? The Data Layout

    The result of the tool is not just ciphertext. To decrypt, you also need the salt and the IV, and they are not secret, so they are stored in front of the ciphertext. The layout is simple, and it is the same in the code examples on this page.

    password mode:  salt (16 bytes) + IV (12 bytes for GCM, 16 for CBC/CTR) + ciphertext [+ 16-byte tag for GCM]
    raw key mode:   IV + ciphertext [+ tag]
    text output:    the bytes above written as Base64 or hex
    file output:    the raw bytes, saved as name.ext.aes

    The color-coded layout bar under the result shows these parts for your own data. Because the format is plain and documented, you can decrypt the output of this tool in your own PHP, Python, Node.js or browser code, and the other way around, which we tested with the examples above.

    AES Encryption in JavaScript, PHP and Python

    The code panel on this page contains complete encrypt and decrypt functions for AES-256-GCM with a password. In JavaScript, it uses the built-in Web Crypto API (crypto.subtle), which works in all modern browsers and Node.js. In PHP, it uses openssl_encrypt and hash_pbkdf2, and in Python it uses the widely used cryptography package. They produce the same data layout as the tool, so a text that you encrypt here can be decrypted by your server, and a value that your server encrypts can be decrypted here. This is useful for debugging encryption problems, for checking that two systems agree and for learning how the pieces fit together.

    Common Uses of AES Encryption

    • Protecting sensitive notes and messages: Encrypt text before you store or send it through a channel that you do not fully trust.
    • Encrypting files before cloud upload: Lock a document or archive with a password before it goes to a drive or an email attachment.
    • Learning and teaching cryptography: See salts, IVs, tags and key derivation with real data in a class or a self-study session.
    • Developing and testing applications: Check that your backend and frontend produce compatible AES-GCM output, or create test data for a unit test.
    • Debugging "bad decrypt" errors: Find out whether the problem is the key, the IV, the mode, the encoding or changed data.
    • Storing secrets in configuration: Understand how an encrypted value in a config file or a database column is built.

    AES Security Best Practices

    • Use a strong, unique password or passphrase: Four or more random words, or a long random string. The strength meter helps you, but a password manager is better.
    • Prefer AES-GCM: It detects changes to your data, while CBC and CTR do not.
    • Never reuse an IV or nonce with the same key: The tool creates a fresh random IV every time. The custom IV option is only for demonstrations and testing.
    • Keep the key secret, not the IV or salt: The IV and salt are stored with the ciphertext on purpose.
    • Do not invent your own encryption scheme: Use well-tested libraries, and keep standard formats.
    • Protect the key as carefully as the data: Strong encryption does not help if the key is in the same folder, in a chat message or in your source code.
    • Keep backups: If you forget the password or lose the key, nobody can recover the data. There is no reset option.

    Why Does Decryption Fail?

    The most common reasons are a wrong password or key, a different algorithm or key size than the one used for encryption, a different number of PBKDF2 iterations, the wrong text format (Base64 instead of hex, or the opposite), extra characters or a line break that was added when the text was copied, and ciphertext that was shortened or modified. With AES-GCM the tool then reports a clear failure, because the authentication tag does not match. With CBC or CTR a wrong key can sometimes produce unreadable output instead of an error, and the tool tells you when the result is not valid text. Check each of these settings in turn, and use the Technical details panel to compare the salt and IV with the ones that you expect.

    Limits of This Demo: Please Read

    This tool is built for learning, testing and light everyday protection, and it uses the real, standard algorithms from your browser. It is not a replacement for audited, full-featured security software when the stakes are high. It does not manage keys for you, does not protect your device against malware or keyloggers, and cannot protect data that you have already shared in plain text. For critical secrets, business-grade storage or legal and medical records, use established tools such as a password manager, full-disk encryption or a vetted file encryption program, and follow your organization's security policy. Also remember that your password is the real lock: a weak one will be guessed, whatever the key size.

    Popular Searches This Tool Helps With

    • AES encryption demo
    • AES encryption online
    • AES decrypt online
    • AES-256 encryption tool
    • AES-GCM encrypt decrypt
    • AES-CBC online
    • encrypt text online free
    • encrypt file with password
    • AES encryption example
    • PBKDF2 AES key derivation
    • how does AES work
    • AES encryption JavaScript PHP Python

    Free AES Encryption Demo Online

    Our free AES encryption demo encrypts and decrypts text and files with AES-128, AES-192 and AES-256 in GCM, CBC and CTR modes, explains every step and runs entirely in your browser. Try it now, with no signup and no upload.

    ADVERTISEMENT
    Demo Ad 300 x 250
    COMMON QUESTIONS

    Frequently Asked Questions About AES Encryption

    Quick answers about AES, its modes, passwords and keys, and how to use this encryption demo safely.

    What is AES encryption?

    AES, the Advanced Encryption Standard, is a symmetric encryption algorithm that was standardized by NIST in 2001 (FIPS 197). The same secret key locks and unlocks the data. It works on 128-bit blocks and supports 128, 192 and 256-bit keys, and it protects HTTPS, Wi-Fi, disk encryption, password managers and many other systems.

    Is AES-256 better than AES-128?

    AES-256 has a larger safety margin and is the usual recommendation, but both are secure against brute force with any technology that exists today. In practice, security depends far more on a strong password or a well-protected key than on the key size. This tool lets you choose 128, 192 or 256 bits, and AES-256 is the default.

    Which AES mode should I use: GCM, CBC or CTR?

    Use AES-GCM. It encrypts and also authenticates the data with a tag, so any change or a wrong key is detected. CBC and CTR only hide the data and do not detect tampering, so use them only to match an older system. This tool does not offer ECB mode, because it leaks patterns in the data.

    Is it safe to encrypt data with this online tool?

    The encryption runs entirely in your browser with the standard Web Crypto API, and your text, files, passwords and keys are never uploaded to a server. The strength then depends on your password, so use a long and unique one. This is a learning and testing tool, so for highly sensitive data use audited security software and follow your organization's rules.

    Can I decrypt the output in my own code, and do you tell me the format?

    Yes. The output is the salt (16 bytes), the IV (12 bytes for GCM, 16 for CBC and CTR), the ciphertext and, for GCM, a 16-byte tag, written as Base64 or hex. The key comes from PBKDF2-HMAC-SHA256 when you use a password. The code panel gives you tested JavaScript, PHP and Python examples for the default settings that work with this tool in both directions.

    What happens if I forget the password or lose the key?

    The data cannot be recovered. AES has no back door and the tool does not store your password or key anywhere. Keep a safe backup of the password or key, for example in a password manager, before you rely on encrypted data.

    Why do I get a decryption error?

    The usual causes are a wrong password or key, a different algorithm, key size or PBKDF2 iteration count than the one used to encrypt, the wrong format (Base64 or hex), extra characters that came with the copied text, or ciphertext that was changed. Make sure that every setting matches the encryption, and check the salt and IV in the Technical details panel.

    ADVERTISEMENT
    Demo Ad 320 x 50

    All Tools, One Place

    Merge, split, compress and convert files in seconds. Explore powerful free tools for all your everyday needs.

    Explore All Tools →