A versatile tool to encode text or files into Base64 and decode Base64 strings back to text or files.
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. It is commonly used to encode data that needs to be stored and transferred over media that are designed to deal with text. This ensures that the data remains intact without modification during transport.
The character set used by Base64 consists of 64 characters: 26 uppercase letters (A-Z), 26 lowercase letters (a-z), 10 digits (0-9), and two additional characters, typically '+' and '/'. A padding character, '=', is also used at the end of the encoded data if necessary.
Here's how you can perform Base64 encoding and decoding in various popular languages:
Encode:
btoa("your string");Decode:
atob("eW91ciBzdHJpbmc=");Encode:
import base64
base64.b64encode(b'your string')Decode:
import base64
base64.b64decode(b'eW91ciBzdHJpbmc=')Encode:
import java.util.Base64;
String encodedString = Base64.getEncoder().encodeToString("your string".getBytes());Decode:
import java.util.Base64;
byte[] decodedBytes = Base64.getDecoder().decode("eW91ciBzdHJpbmc=");
String decodedString = new String(decodedBytes);Encode:
base64_encode('your string');Decode:
base64_decode('eW91ciBzdHJpbmc=');Encode:
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes("your string");
string encodedString = System.Convert.ToBase64String(plainTextBytes);Decode:
var base64EncodedBytes = System.Convert.FromBase64String("eW91ciBzdHJpbmc=");
string decodedString = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);