Cover Theme
What is Base64?
Base64 is a binary-to-text encoding scheme. It represents binary data in an ASCII string format by translating it into a radix-64 representation.
The name comes from the fact that it uses exactly 64 characters to represent data: `A-Z`, `a-z`, `0-9`, `+`, and `/`, with `=` used for padding.
When Should You Use Base64?
Base64 is widely used for:
- undefined
JavaScript Encoding & Decoding
Modern browsers provide native functions for Base64:
// Encoding a string
const original = "Hello World!";
const encoded = btoa(original);
console.log(encoded); // "SGVsbG8gV29ybGQh"
// Decoding a string
const decoded = atob(encoded);
console.log(decoded); // "Hello World!"
Note that `btoa` and `atob` only support ASCII characters. For Unicode/UTF-8 strings, you need a helper function to avoid errors.
Try our [Base64 Encoder/Decoder](/tools/base64-encoder) to safely encode and decode text, including full UTF-8 Unicode characters.
Key Takeaways
Base64 Encoder
Encode and decode Base64 text and files -100% client-side.