Base64 Encoder & Decoder handles the lingua franca for safely embedding binary data in text contexts: email attachments, JWT payloads, data URIs, API tokens, and cookie values all rely on it. This tool handles both text-to-Base64 and file-to-Base64 in one place, with support for URL-safe encoding and data URI generation - everything happens locally in your browser.
Text encoding converts your string's UTF-8 bytes to Base64. File encoding reads the file's raw bytes directly and produces a Base64 string or a complete data URI (data:image/png;base64,...) that can be embedded in HTML, CSS, or JSON. Data URIs let you include images and fonts in HTML without separate HTTP requests - useful for small assets but impractical for large ones due to the 33% size overhead.
+// with -/_)A data URI has the form data:[mediatype];base64,[encoded-data]. You can use it anywhere a URL is expected in HTML or CSS - for example as an img src or a CSS background-image. No separate network request is made.
Yes. Paste the data URI, click Decode, and download the resulting binary content as a file. The tool strips the data:...;base64, prefix before decoding.
Base64 produces roughly 4 characters for every 3 bytes of input - a 33% overhead. A 1 MB file becomes approximately 1.33 MB Base64.
Yes - JSON only supports strings, numbers, arrays, and objects. Binary data must be serialised as a Base64 string to be valid JSON. This is the standard approach for APIs that exchange binary blobs.
See also File to Base64, ASCII85, and the Base32 tool for encodings related to this Base64 Encoder & Decoder.
This Base64 Encoder & Decoder follows 📖 Reference: RFC 4648 - The Base16, Base32, and Base64 Data Encodings