Base64 Encoder and Decoder
Turn plain text into Base64, or decode Base64 back to text. Everything runs locally in your browser.
Base64 tool
What is Base64 encoding?
Base64 represents binary data using 64 safe ASCII characters (A–Z, a–z, 0–9, +, /) plus padding =. Each character encodes 6 bits of data, so four Base64 characters carry three bytes (24 bits) of payload.
It exists so arbitrary bytes can travel through systems that only handle text safely—email bodies, URLs, JSON, XML, and older protocols that might corrupt raw binary. It is not a compression or encryption format.
Common uses include MIME attachments in email, data: URIs for small images or fonts, JWT header and payload segments (before signing), and storing opaque tokens or blobs in APIs and configuration.
How Base64 works
Encoding takes the input as a stream of bytes. Those bytes are grouped into 24-bit chunks. Each chunk is split into four 6-bit indices (0–63), and each index maps to one of the 64 alphabet characters.
If the byte length is not divisible by three, the final quantum is padded: one or two = characters mark missing bytes so decoders know the original length.
Decoding reverses the process: Base64 characters map back to 6-bit values, bits are reassembled into bytes, and you recover the original binary or text (depending on what was encoded).
When to use Base64
- Embedding small assets inline (e.g. icons) as data URIs in HTML or CSS.
- Sending binary payloads inside JSON or XML where only text is allowed.
- Email and MIME: representing attachments as text inside the message.
- Storing or displaying opaque byte sequences in logs, configs, or debug output—when readability matters more than size.
Avoid Base64 when you need secrecy (use proper encryption) or minimal size (Base64 expands data).
FAQ
- Is Base64 encryption?
- No. Base64 is reversible encoding. Anyone with the string can decode it. Do not rely on it to protect sensitive data.
- Why is Base64 output longer?
- Four characters represent three bytes, so encoded size grows by about 33%. Padding adds a few more characters when the input length is not a multiple of three.
- Can I encode images?
- Yes—images are binary files, and Base64 is a standard way to represent those bytes (for example in data URIs). This page is text-oriented; for large files, use a dedicated file encoder in your workflow.
- Is this tool free?
- Yes. There is no charge and no account required. Processing happens in your browser; we do not receive your input.