Base64 Encode

Paste your text below and click Encode to convert it to Base64. Supports UTF-8 text. All processing happens locally in your browser.

Copied!

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It is commonly used to embed images in HTML/CSS, transmit data in URLs, encode email attachments (MIME), and store complex data in JSON or XML.

The encoding uses 64 characters: A-Z, a-z, 0-9, +, and /, with = for padding.

This page encodes with the browser's own Base64 function, so the result is exactly what any standard library would produce: the standard alphabet, with equals-sign padding, on one line. Nothing is uploaded and nothing is stored.

Debugging something that will not decode?

A payload that will not decode is usually a symptom rather than the fault: a double encoding somewhere in the pipeline, a charset assumed instead of declared, a token signed over bytes that are not quite the bytes anyone expected. We do this kind of work, on integrations, APIs and the systems that pass data between them.

Tell us what is breaking

Frequently Asked Questions

What is Base64 encoding used for?
It exists to move bytes through channels that only carry text reliably. Email attachments, data URIs in CSS and HTML, JSON fields that have to hold a file, keys and certificates in PEM form, and HTTP basic authentication headers all use it. It is neither compression nor encryption: it is a way of spelling arbitrary bytes with 64 characters that survive almost any transport.
Why is Base64 about a third larger than the original?
Because it spends four characters on every three bytes. Three bytes are 24 bits, and Base64 splits those into four groups of six bits, each of which becomes one character. That is a fixed ratio of four to three, or about 33 percent more, before you add padding and any line breaks.
Is Base64 a form of encryption?
No, and treating it as one is the most common mistake made with it. There is no key and nothing secret: anyone can decode a Base64 string in a single step, this page included. It hides data from a casual glance and from software that would choke on raw bytes, and that is all it does. If the content needs protecting, encrypt it, then Base64 the ciphertext if the transport needs text.
What is the difference between standard and URL-safe Base64?
Two characters. Standard Base64 uses a plus sign and a forward slash for values 62 and 63, and both already mean something inside a URL, so they get percent-encoded there. The URL-safe variant swaps them for a hyphen and an underscore. This page emits the standard alphabet; if you need the URL-safe form, replace those two characters afterwards.
Should I inline images as Base64 in my CSS?
Sometimes, for very small ones. Inlining removes a request, which used to matter a great deal, but it also makes the image about a third larger, stops it being cached separately from the file carrying it, and holds up that stylesheet until the whole blob has been parsed. As a rough line, it earns its place for icons of a few hundred bytes and rarely earns it above a couple of kilobytes. Over HTTP/2 and HTTP/3 the saved request is worth much less than it once was.