Base64 Encode Online

Simply enter your data then push the "Base64 Encode" button.

About Base64 Encoder

Base64 Encoder is an easy to use tool that converts text to base64 code. This tool can save your time and help encode base64 data.

You can type or paste any text data in the input text area and Base64 Encoder will convert it into base64 code.

Uses of Base64

The actual use of base64 was limited to a safe way to transmit data across machines. With time, it has been integrated into the implementation of several core Internet technologies such as encryption and file embedding.

Methods of Base64 encoding in various programming languages

"str" indicates the original text and "base64" indicates the encoded result.

Base64 Encoding in Java base64 = new BASE64Encoder().encode(str.getBytes());
Base64 Encoding in JavaScript base64 = btoa(str); // IE 10- Requires the introduction of base64.js
or
var s = CryptoJS.enc.Utf8.parse(str);
base64 = CryptoJS.enc.Base64.stringify(s); // Requires the introduction of CryptoJS
Base64 Encoding in PHP $base64 = base64_encode($str);
Base64 Encoding in C#/.NET byte[] bytes = System.Text.Encoding.UTF8.GetBytes(str);
base64 = System.Convert.ToBase64String(bytes);
Base64 Encoding in Python import base64
base64 = base64.b64encode(str)
Base64 Encoding in Perl use MIME::Base64;
$base64 = encode_base64($str);
Base64 Encoding in Golang import b64 "encoding/base64"
...
base64 := b64.StdEncoding.EncodeToString([]byte(str))
Base64 Encoding in Ruby require "base64"
base64 = Base64.encode64(str)
Base64 Encoding in MySQL/MariaDB SELECT TO_BASE64(str);
Base64 Encoding in PostgreSQL SELECT encode(str, 'base64');
Linux Shell(Take 'test' for example) $ echo test | base64 // dGVzdAo=