Skip to main content
Base64 Encoder & Decoder — Online Base64 String, Image & File Tool
Binary & String Encoding Tool

Base64 Encoder & Decoder — Online Base64 String, Image & File Tool

A fast, private, and bidirectional base64 encoder decoder. Easily encode base64 text or binary files, decode base64 strings, convert images and PDFs to Base64, and reference CLI terminal command line workflows.

Plain Text Input

0 chars / 0 bytes

Base64 Encoded String

0 chars / 0 bytes

What is Base64 Encoding and Decoding?

Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The Base64 alphabet consists of 64 characters: uppercase letters A–Z (indices 0–25), lowercase letters a–z (indices 26–51), digits 0–9 (indices 52–61), and two punctuation symbols (conventionally + and /, with = reserved for padding).

Using an online base64 decoder or base64 encoder decoder is standard practice in web engineering when binary data (such as cryptographic hashes, image thumbnails, JWT tokens, or authentication credentials) needs to be safely transmitted across protocols that were historically designed for 7-bit ASCII text, such as SMTP email MIME or URL query parameters.

Base64 Variant Alphabet Characters Padding Character Standard RFC & Use Cases
Standard Base64 A–Z, a–z, 0–9, +, / = (1 or 2 bytes) RFC 4648 §4. MIME email bodies, XML signatures, HTTP Basic Authentication headers.
URL-Safe Base64 A–Z, a–z, 0–9, -, _ Omitted / Optional RFC 4648 §5. JSON Web Tokens (JWT), web URL query parameters, REST API slugs.

Base64 Decoder for Images and PDFs

In modern web applications, small media assets are frequently embedded directly into HTML or CSS stylesheets as Data URIs using a base64 decoder image or base64 pdf decoder format:

<!-- Direct embedded Base64 PNG image --> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=" alt="Pixel" />

This avoids additional HTTP round-trips for tiny icons, avatars, or PDF documents. However, Base64 increases data size by exactly 33.3% (every 3 bytes of raw binary data expand into 4 ASCII characters), so large video or photographic assets should remain external files served via HTTP/2 or CDNs.

Programmatic Code Implementation

JavaScript (UTF-8 Safe Node.js and Browser)

Standard browser window.btoa() throws an exception when encountering UTF-8 characters above code point 255. Here is the modern decode base64 javascript implementation using Web APIs:

// UTF-8 compliant Base64 Encode in Browser JavaScript function utf8ToBase64(str) { const bytes = new TextEncoder().encode(str); const binString = Array.from(bytes, (byte) => String.fromCharCode(byte)).join(""); return btoa(binString); } // UTF-8 compliant Base64 Decode in Browser JavaScript function base64ToUtf8(base64) { const binString = atob(base64); const bytes = Uint8Array.from(binString, (m) => m.charCodeAt(0)); return new TextDecoder().decode(bytes); } // Node.js Buffer implementation const encoded = Buffer.from("Hello World", "utf-8").toString("base64"); const decoded = Buffer.from(encoded, "base64").toString("utf-8");

Python (base64 module)

In Python, use the standard base64 library for base64 python encode and decode tasks:

import base64 # Standard base64 encode and decode data = "Engineering Grade Data".encode("utf-8") b64_str = base64.b64encode(data).decode("ascii") original = base64.b64decode(b64_str).decode("utf-8") # URL-safe base64 encoding (replaces + with - and / with _) url_safe_b64 = base64.urlsafe_b64encode(data).decode("ascii")

Java (java.util.Base64 & Apache Commons)

Modern Java applications use java.util.Base64, while older systems use Apache Commons Base64.encodeBase64():

import java.util.Base64; import java.nio.charset.StandardCharsets; // Java 8+ Standard Base64 String text = "Enterprise Payload"; String encoded = Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8)); byte[] decodedBytes = Base64.getDecoder().decode(encoded); String decoded = new String(decodedBytes, StandardCharsets.UTF_8);

Frequently Asked Questions

Base64 decoding translates ASCII radix-64 strings back into original binary or text format. It is essential when parsing HTTP headers, reading email MIME attachments, validating API tokens, or extracting embedded image and PDF assets.
Standard browser window.btoa() only supports Latin1 ASCII characters. This tool utilizes the modern TextEncoder and TextDecoder APIs, ensuring full compatibility with multi-byte international text and emojis without exceptions.
Yes. Under the "File, Image & PDF" tab, upload any image or document to generate its Base64 or Data URI string. You can also paste an existing Base64 image string to view a live visual preview and download the file.
Standard Base64 contains + and /, which can break web URLs and query strings. URL-Safe Base64 (RFC 4648 §5) substitutes - for + and _ for /, omitting trailing = padding.
On Linux and macOS, pipe text to base64 -d (Linux) or base64 -D (macOS). On Windows, use PowerShell's [System.Convert]::FromBase64String() or the built-in certutil -decode utility.
No. All text and file encoding and decoding operations execute 100% locally within your client browser using HTML5 Web APIs. Zero data is uploaded or stored.