Menu logo

Thoughts on Software Engineering

Online AES Encryption Tool

Few day ago I needed a JavaScript AES implementation (the Rijndael advanced encryption algorithm) which I can test instantly in my Web browser (two fields “text” and “password” and “encrypt” button). I searched for “online AES tool” but found nothing that is ready-to-use so I needed to write one. For those who need instant online Browser-based JavaScript AES encryptor / decryptor that runs without any plugins client-side, enjoy! Thanks to Mark Percival for his AES JavaScript library.

How the JavaScript AES Encryptor / Decryptor Works?

This online form encrypts with AES (Rijndael) instantly given text with the AES-128 algorithm and produces a BASE64-encoded output: cipher = BASE64_Encode(AES_Encrypt(text, password)). The algorithm first extracts a 128-bit secret key and AES IV (initial vector) from the password and then after padding the input encrypts it (by 128-bit blocks). Finally the encrypted binary result is encoded in BASE64. A random salt is injected along with the password to strengthen the encryption code. The key-extraction algorithm and the format of the output AES-encrypted message is compatible with OpenSSL.

The decryption algorithm first decodes the BASE64 string, extracts from it the random salt used during the encryption, extracts the AES key and IV from the password and the salt and decrypts back the encrypted text.

The encryption / decryption implementation of the AES (Advanced Encryption Standard, a.k.a. Rijndael) algorithm in JavaScript is written by Mark Percival (see his open-source project gibberish-aes at GitHub).

AES Online Encryption Tool – Source Code

Below is the source code of the online AES encryption tool:

<!DOCTYPE html>

	<script type="text/javascript" src=""></script>
	<script type="text/javascript" src=""></script>
	<title>Free Online AES Tool - Encrypt / Decrypt Text with AES Online</title>

	<h1>Online AES Encryptor / Decryptor - Free AES Tool</h1>
	<h2>(JavaScript client-side AES cipher implementation)</h2>

			<td>Text to encrypt:</td>
			<td><textarea id="text" />Enter the text to be encrypted here...</textarea></td>
			<td><input id="password" value="some password" /></td>
			<td>Encrypted text:</td>
			<td><textarea id="encryptedText" readonly="readonly"></textarea></td>
			<td>Decrypted text:</td>
			<td><textarea id="decryptedText" readonly="readonly"></textarea></td>
			<td colspan="2" align="center">
				<button id="buttonStart">AES Encrypt / Decrypt</button>

		$('#buttonStart').click(function() {
			var text = $('#text').val();
			var pass = $('#password').val();
			var encrypted = GibberishAES.enc(text, pass);
			var decrypted = GibberishAES.dec(encrypted, pass);
Comments (25)

25 Responses to “Online AES Encryption Tool”

  1. Ivan Tcholakov says:

    I’ve made an effort for porting GibberishAES (256-bit keys only) to PHP. Please, have a look here:

  2. O. Bacak says:

    Thanks, it is just what i was looking for..

  3. ELZahar says:

    thanks for the great work, i try to use this script to encrypt my PHP files, but can not be able to make browser read my encrypted PHP files and view the page while the file still encrypted if viewing by text viewer.

    sorry about by poor English, and hope you can help me learn that secrets.


  4. Richard says:

    Hi team,

    In your description “How the JavaScript AES Encryptor / Decryptor Works?”, it says

    Being curious what the above means, I tried an example on your site and another site:

    plainText: “my first encryption.”
    password: “nakov”
    cipherText: “U2FsdGVkX18cnIcugS19jSVcnyKtI192DqWx7P/JhZ26jjounYIDZ32xe64s/dPH”

    I found differences for your site vs

    plainText: “my first encryption.”
    password: “nakov”
    cipherText: “U2FsdGVkX1+NGmre3/Yms/uIQk00YiS+GP0/AxkCqcXbzYSzVDhYFhyXavx7P9dA”

    The first portion of cipherText result STARTS OUT the same but THEN becomes different.

    I have 3 followup questions about your code:
    1) Do you use AES128/CTR mode or AES128/ICM mode?
    2) Is “password” used as “Key128” and/or “InitialVector”?
    3) If its a Key, what is the value of IV128?
    4) If its an IV, what is the value of Key128?

    Any insight (from either you or Mark Percival) is greatly appreciated.


  5. Richie H. says:

    How to decrypt the “encryption” after it is encoded?

    In other words, I write a message and send the encrypted text-code to my friend. How then does he decrypt it?

  6. nakov says:

    @Richie: you need to modify the above example’s source code. Use a piece of code like this:

    // var text = $(‘#text’).val();
    var pass = $(‘#password’).val();
    // var encrypted = GibberishAES.enc(text, pass);
    var encrypted = $(‘#encryptedText’).val();
    // $(‘#encryptedText’).val(encrypted);
    var decrypted = GibberishAES.dec(encrypted, pass);

  7. Abolfazl Beigi says:

    Thanks a lot. useful.

  8. Kevin says:

    here there are so many js libraries:

  9. leon says:

    i can not decrypt this line
    // decrypt encrypted mgcamd gbox line for (i = 0; i < 6; i++) key[i * 2] = mac[i]; AES_KEY aeskey; AES_set_decrypt_key(key, 128, &aeskey); for (i = 0; i < len; i+=16) AES_decrypt(buf + i,buf + i, &aeskey);


    crypt key is mac adress 00:09:34:1C:55:48
    thanks if you help me
    [email protected]

  10. Continued says:

    Fantastic beat ! I would like to apprentice while you amend your site,
    how could i subscribe for a blog website? The account aided me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast provided bright clear idea

  11. Achyuth Ajoy says:

    Nice Implementation. I wish to know whether i can decrypt the values using php script.

  12. Thanks for sharing your thoughts about 128-bit AES encryption
    tool. Regards

  13. Link exchange is nothing else but it is only placing the other person’s website link on your page at appropriate place and
    other person will also do same in support of you.

  14. Ivan Tcholakov says:

    An amendment of my comment #1. The PHP implementation of GibberishAES now supports 128, 192, and 256-bit keys.

  15. PHP exp says: An implementation of AES in php based on mcrypt,

  16. Tiara says:

    After looking at a handful of the blog posts on your site, I truly like your technique of
    blogging. I saved it to my bookmark site list and will be checking back
    soon. Please visit my web site too and let me know your opinion.

  17. says:

    Awesome blog you have here but I was wondering if you knew of any community forums that
    cover the same topics talked about in this article? I’d really like to be a part of community
    where I can get comments from other knowledgeable people that share the
    same interest. If you have any recommendations, please let me know.

  18. Emmanuel says:

    I got this web site from my friend who shared wih
    me regarding thiis web page and at the moment thks
    time I am visiting this site and reading very informative ontent att thos place.

  19. Lyle says:

    Hello, i think that i saw you visited mmy website
    so i got here to return the favor?.I’m attempting to
    to find issues to enhance my site!I guess its good
    enough to make use of a feww of your ideas!!

  20. Anonymous says:

    Could you specify the Cipher Mode that is being used? (CBC, ECB, CFB, etc).

  21. nakov says:

    It uses CBC OpenSSL padding scheme.

  22. Sarah Homer says:

    Great post. Please check my tool for This is AES Encryption Decyption tool with OpenSSL Interoperability.

RSS feed for comments on this post. TrackBack URL