Base64 Encode and Decode

The Base64 Encode and Decode tool enables you to turn text and images into an ASCII string format via translation to a Base64 string, which for example used in emails to transfer attachments. The term Base64 is coming from a specific MIME content transfer encoding. This MIME implementation uses A-Z, a-z, and 0-9 to encode the data.

As an example, you can take the text "Hello World!" Base64 encoded it would turn to "SGVsbG8gV29ybGQh" and if you decode this string again you will get your "Hello World!" back. Further details you can find on Wikipedia.

Encode and Decode Text

 

Result

📋 Copy Code

DIY PHP and Javascript

In PHP, you can use the functions base64_encode and base64_decode to encode and decode your data.

echo base64_encode("Hello World!"); // SGVsbG8gV29ybGQh
echo base64_decode("SGVsbG8gV29ybGQh"); // Hello World!
📋 Copy Code

In Javascript, you can use "window.btoa" to encode and "window.atob" to decode data. All major browsers support these two methods.

alert(window.btoa("Hello World!")); // SGVsbG8gV29ybGQh
alert(window.atob("SGVsbG8gV29ybGQh")); // Hello World!
📋 Copy Code