Convert text and files to Base64 instantly, or decode Base64 strings back to their original format. Supports standard Base64, the URL-safe variant, image preview, and file uploads up to 5MB.
Images, PDFs, text files — Max 5MB. Get Base64 data URI instantly.
Base64 converts binary data — images, files, audio — into text using 64 ASCII characters. Common uses include embedding images in HTML/CSS, JSON APIs, email attachments (MIME), JWT tokens, and data URIs.
Standard Base64 uses the + and / characters. URL-safe Base64 replaces them with - and _ to avoid URL encoding issues. Use URL-safe for web APIs, JWT tokens, and filenames.
Yes. Upload any image (PNG, JPG, GIF, WEBP) in the File tab to get a complete data URI ready for HTML img tags or CSS background-image.
Base64 increases size by roughly 33–37%. A 1MB image becomes about 1.33MB as Base64. This is the trade-off for converting binary data into text format.
Yes. All processing happens in your browser. Files never leave your device or get uploaded to any server.
The Logrith Base64 Encoder & Decoder is a free online tool for developers, designers, and technical users who need to convert between binary data and Base64 text format instantly. Whether you need to encode text for JSON APIs, convert images into data URIs for HTML and CSS, decode JWT token segments, or handle email attachments, this tool processes everything directly in your browser with zero server uploads.
Base64 encoding solves a fundamental problem: many systems, like JSON, XML, and older email protocols, were built to safely carry text but not arbitrary binary data. Base64 gets around this by representing binary bytes using a fixed alphabet of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /), so images, PDFs, audio clips, and any other binary content can travel safely through text-only channels without corruption.
Base64 encoding works by grouping the input's raw bytes into chunks of three bytes (24 bits) at a time, then splitting each 24-bit chunk into four 6-bit groups. Each 6-bit group (a number from 0 to 63) is mapped to one character from the Base64 alphabet. This is why Base64 output is always about 4/3 the size of the original binary input — three bytes of input always become four characters of output, an increase of roughly 33%.
When the input length isn't a clean multiple of three bytes, padding characters ("=") are added at the end to complete the final group. This is a normal and expected part of standard Base64 — it's not an error, and most decoders handle padding automatically.
The standard Base64 alphabet includes '+' and '/' as two of its 64 characters. Both of these characters have special meaning inside URLs ('+' can be interpreted as a space, and '/' is a path separator), which causes problems if you try to put standard Base64 directly into a URL or filename without additional encoding.
URL-safe Base64 solves this by substituting '-' for '+' and '_' for '/', and it commonly strips the trailing '=' padding characters entirely. This variant is what you'll see used in JWT (JSON Web Token) headers and payloads, in many REST API query parameters, and in filenames generated from encoded content. This tool supports both variants through a simple dropdown, so you can produce exactly the format your target system expects.
data:image/png;base64,... avoids an extra HTTP request for small icons or inline graphics.This tool bundles three related workflows into one interface. The Encode tab converts plain text into Base64, with a choice of standard or URL-safe output and a live stats readout showing the original size, encoded size, and percentage overhead. The Decode tab reverses the process — paste in a Base64 string and get the original text back, with an automatic image preview if the decoded content turns out to be a recognizable image format. The File tab handles binary files directly: drag and drop, or click to browse, and the tool reads the file and produces a ready-to-use Base64 data URI, along with a preview of the original file when it's an image.
Frontend developers commonly use Base64 to embed small icons, logos, or placeholder images directly into CSS or HTML, avoiding extra network requests for tiny assets. Backend developers use Base64 when building or debugging APIs that transmit files, images, or binary blobs as part of a JSON response. DevOps engineers frequently encounter Base64 in configuration management tools and CI/CD pipelines, where secrets, certificates, or binary files are stored as Base64 strings inside YAML or JSON config files. Regardless of which of these roles you're in, having a fast, reliable, no-signup encoder/decoder saves time compared to writing a one-off script for a quick conversion.
Every encode, decode, and file conversion in this tool happens entirely inside your browser using built-in JavaScript functions. Nothing is uploaded to a server, logged, or stored anywhere outside your own device. This makes the tool suitable even for sensitive internal data, configuration secrets, or private files that you don't want passing through a third-party server.
JSON Web Tokens (JWTs) are one of the most common places developers encounter Base64 directly. A JWT is made up of three parts separated by dots: a header, a payload, and a signature. The header and payload are both plain JSON objects that get Base64-URL-encoded before being joined together. This means you can take the first two segments of any JWT, paste each into the Decode tab of this tool, and see the exact JSON claims inside — useful for debugging authentication issues, inspecting token expiry, or verifying which claims an API is actually sending, without needing to trust a third-party JWT debugging website with your token.
It's worth remembering that Base64 encoding is not encryption. Anyone who can see a JWT can decode its header and payload instantly, which is exactly what this tool demonstrates. The security of a JWT comes entirely from its signature, not from the fact that the payload is Base64-encoded rather than plain JSON.
When you convert an image to Base64 using the File tab, the tool produces a "data URI" — a complete string starting with something like data:image/png;base64, followed by the encoded image bytes. This single string is a fully self-contained representation of the image that can be dropped directly into an HTML <img src="..."> attribute or a CSS background-image: url(...) declaration, with no separate image file or additional HTTP request required.
This technique is especially useful for small, frequently-used icons, logos, or UI graphics, where avoiding an extra network round-trip can measurably improve page load performance. It's generally not recommended for large photos or high-resolution images, since the roughly 33% size increase from Base64 encoding, combined with the fact that data URIs can't be cached separately by the browser the way a regular image file can, tends to outweigh the benefit once the image gets larger than a few kilobytes.
If the Decode tab reports an invalid Base64 string, a few common causes are usually to blame. First, check whether the string includes URL-safe characters ('-' and '_') — this tool automatically detects and normalizes those, but some other decoders don't, so a string that decodes fine here might fail elsewhere if the target system expects strictly standard Base64. Second, check for accidental whitespace, line breaks, or truncation — Base64 strings copied from some sources (like certain email clients or terminal outputs) can pick up extra line breaks that need to be stripped before decoding. Third, confirm the string length is what you expect; a Base64 string that was cut off mid-copy will usually fail to decode because its length won't divide evenly according to the format's padding rules.
Base64 is often mentioned alongside other encoding schemes like hexadecimal (hex) encoding or URL percent-encoding, but each serves a different purpose. Hex encoding represents each byte as two hexadecimal characters, which is simple and human-readable for short values like color codes or hashes, but roughly doubles the size of the original data — significantly less space-efficient than Base64's ~33% overhead for larger payloads like files and images.
URL percent-encoding (the %XX style you see in URLs) is designed specifically for making arbitrary text safe inside a URL, not for compactly representing binary data — it can massively inflate the size of binary content, since many bytes need a three-character %XX representation. Base64 sits in a useful middle ground: it's reasonably compact, entirely composed of safe, printable ASCII characters, and works well for embedding binary content inside text-based formats like JSON, XML, and HTML, which is exactly why it has become the de facto standard for this kind of conversion across web technologies.