Encode Base64 - Free Online Base64 Encoder

How to use Base64 encoder tool?

Three simple steps:

  1. Type or paste your data that needs to be encoded to the first input.

  2. Click on "Encode with Base64" button.

  3. Encoded data will appear in the second input.

  4. Please use "Paste example" button at the top of the page to quicky see the tool in action.

Base64 Encoding: What it is and why it is important

Base64 encoding is a process of converting binary data to an ASCII format. In this way, binary data can be stored and transferred to other systems in non-binary format. This is important because sometimes data can be transferred only in text format, so binary data needs to be converted before it can be sent. The most common case is when we communicate with a server using JSON REST API and need to carry the data like JPEG image. But sending or storing only base64 text isn't enough. We should not forget about keeping the original filename and MIME type of the file to be able to decode and restore it properly.

It might seem like Base64 encoding is an encryption or compression technique but it really isn't. In reality, base64 encoded data size is about 33% greater than the original data size.

Sometimes base64 encoding can be used as a simplest way to hide some text information to make it unreadable. But we should remember that it isn't encryption so it isn't safe to store passwords in database using only base64 encoding. Anybody who could gain access to the data will easily get plain text passwords if they are only encoded with base64.

How to encode data with base64 using JavaScript?

This can be done by using the "btoa()" function. The function accepts a single argument (string) and returns a string (base64 encoded data). Simple!

Ok, I encoded my data. How to decode it?

If you would like to decode base64 data with JavaScript in the browser, you can open console in developer tools and use "atob()" function. The function accepts a single argument (base64 encoded string) and returns a string with original binary data. Easy!

If you wish to do it online, try base64 decoder tool.