Base64 Decode and Encode Plugin - base64.js

Base64 Decode and Encode Plugin - base64.js
File Size: 5.63KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

base64.js is a simple jQuery plugin that helps you create a Base64 converter for encoding a string to base64 or decoding a base64 string. With this jQuery plugin, you can create a online Base64 converter service for helping others.

What is Base64?

Base64 is a group of similar encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The Base64 term originates from a specific MIME content transfer encoding. More about Base64.

How to use it:

1. Markup

<div>
<label for="encode">Encode: </label>
<input id="encode" type="text" value="jQueryScript.Net" placeholder="encode">
</div>
<br>
<div>
<label for="decode">Decode: </label>
<input id="decode" type="text" value="alF1ZXJ5U2NyaXB0Lk5ldA==" placeholder="decode">
</div>

2. Include jQuery Library and base64.js

<script src='http://code.jquery.com/jquery-1.9.1.min.js'></script> 
<script src='jquery.base64.js'></script> 

3. Call the plugin

<script>
    var dec = $('#decode'),
    enc = $('#encode');

    enc.keyup(function () {
    dec.val( $.base64('encode', this.value) );
    // also possible:
    // dec.val( enc.base64('encode', this.value) );
    // dec.val( enc.base64().encode(this.value) );
    });


    dec.keyup(function () {
    enc.val( $.base64().decode(this.value) );
    });
</script>

Change Log:

v0.0.3 (2013-02-20)

  • Updated example page

This awesome jQuery plugin is developed by unknown. For more Advanced Usages, please check the demo page or visit the official website.