Encode plain text or files to Base64, or decode Base64 strings back to readable text, instantly in your browser. No server, no signup, nothing leaves your device.
Base64 Encoder / Decoder
Drop a file here or browse to upload
Images, PDFs, text files, JSON — any file under 5 MB
What Is Base64 Encoding?
Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used whenever binary data needs to be transmitted over systems designed to handle text, such as email, JSON APIs, data URLs, and HTTP headers.
The name "Base64" refers to the 64 printable characters used in the encoding alphabet. Every 3 bytes of raw data become exactly 4 Base64 characters, so encoded output is always about 33% larger than the original. A padding character (=) is added to the end if the input length is not a multiple of three.
Base64 is not encryption. It does not protect data from being read, anyone with a Base64 decoder can recover the original content immediately. It is purely a format transformation for compatibility purposes.
When Do You Actually Need Base64?
Developers and content professionals run into Base64 requirements more often than they might expect. Here are the most common real-world scenarios.
Embedding images in HTML or CSS
Instead of referencing an external image file, you can embed its Base64-encoded content directly into a data: URI. This eliminates one HTTP request and keeps assets self-contained. Small icons and logos under 5 KB are good candidates. Larger images are better kept as separate files to avoid bloating your HTML.
API authentication headers
HTTP Basic Authentication encodes the username and password combination as username:password in Base64 and sends it in the Authorization header. Most REST API clients handle this automatically, but understanding the underlying Base64 format helps when debugging authentication issues.
Email attachments and MIME encoding
The MIME standard uses Base64 to encode binary email attachments so they can travel safely through email servers that only handle plain text. If you have ever opened a raw email source and seen a wall of seemingly random characters, that is Base64-encoded attachment data.
Storing binary data in JSON or XML
JSON and XML do not have native binary types. Base64 is the standard way to include file contents, images, or cryptographic signatures inside a JSON payload or XML document without breaking the format.
JWT tokens
JSON Web Tokens (JWTs) use URL-safe Base64 (Base64url) to encode both the header and payload sections. When you decode the middle section of a JWT, you get the readable JSON claims object, which is why JWTs should never carry sensitive data you assume is hidden.
CSS background images and fonts
Web fonts in WOFF or TTF format can be embedded directly in a stylesheet using Base64 data URIs. This is common in email templates and self-contained HTML documents that cannot reference external files.
Standard Base64 vs URL-Safe Base64
The standard Base64 alphabet uses + and / as its 62nd and 63rd characters. These characters have special meaning in URLs, which causes problems when a Base64 string appears in a query parameter or path segment.
| Variant | Characters 62–63 | Padding | Use Case |
|---|---|---|---|
| Standard Base64 | + and / | = | Email, file encoding, general data |
| URL-safe Base64 | - and _ | Optional | URLs, JWTs, query parameters |
| MIME Base64 | + and / | = with line breaks at 76 chars | Email attachments, MIME bodies |
This tool supports both standard and URL-safe output via the toggle above the input area. The URL-safe variant replaces + with - and / with _. Padding characters are retained in standard mode and can be omitted in URL-safe mode depending on the target system.
How Base64 Encoding Works
Understanding the mechanics helps you debug encoding issues and size calculations.
Base64 processes input in 3-byte (24-bit) groups. Each group is split into four 6-bit chunks. Each 6-bit value maps to one of the 64 printable characters in the alphabet. If the input does not divide evenly into groups of three, padding characters (=) fill the remaining positions.
Size calculation: Base64 output is always ⌈n/3⌉ × 4 characters long, where n is the number of input bytes. A 100-byte input produces exactly 136 Base64 characters (with padding). The overhead is reliably 33% plus up to 2 padding characters.
The encoding is completely deterministic — the same input always produces the same Base64 output regardless of which encoder you use. If you are getting different results from two tools, check whether one is using URL-safe mode or stripping padding characters.
Common Base64 Mistakes and How to Fix Them
Incorrect padding
Base64 strings must have a length that is a multiple of 4. If a string has been truncated or the padding = characters have been stripped, most decoders will throw an error. Add one or two = characters to the end until the length is divisible by 4. This tool handles padding automatically on both encode and decode.
Whitespace and line breaks
Some Base64 encoders (particularly MIME encoders) insert line breaks every 76 characters. When decoding, these breaks must be stripped first. This decoder removes all whitespace before processing, so MIME-formatted Base64 decodes correctly without any manual cleanup.
Wrong character set for URLs
If a standard Base64 string appears in a URL without encoding, the + characters are interpreted as spaces and / characters can break path parsing. Always use URL-safe Base64 (with - and _) for anything that appears in a URL, JWT, or query string.
Encoding already-encoded data
Double-encoding is a common mistake when building API integrations. If your decoded output looks like another Base64 string, you have encoded the data twice. Decode once more to get the actual content.
Base64 for SEO and Content Teams
Base64 is not just a developer concern. Content and SEO teams encounter it in several practical situations.
- Email template images. Inline Base64 images in HTML emails ensure images display even when recipients have external images blocked, which matters for email open tracking and click-through rates.
- Schema markup with embedded images. Some structured data implementations embed small logo or image files as Base64 data URIs directly in JSON-LD schema. This keeps the schema self-contained and guarantees the image is always accessible to AI parsers and Google's Rich Results system.
- Open Graph image debugging. When testing social share cards, tools sometimes return Base64-encoded image previews. Being able to decode them quickly confirms the image is correct before publishing.
- API credential setup. Setting up Google Search Console, Analytics, or third-party SEO APIs via HTTP Basic Auth requires Base64-encoding your credentials as described in their documentation.
Frequently Asked Questions
Format, validate, and minify JSON in one click. Pairs perfectly with Base64 when working with API payloads and JWT tokens.
Format JSON → Technical SEOGenerate JSON-LD schema for FAQs, articles, and local business. Structured data that AI engines and Google can actually parse.
Generate Schema → AI SEOCheck how AI-ready your content is across 15 citation signals. See if ChatGPT and Google AI Overviews will cite your page.
Check AEO Score → Search SEOPreview exactly how your title tag and meta description appear in Google search results before you publish.
Preview SERP →