Home » Base64 Encoder & Decoder

Base64 Encoder & Decoder

Free Base64 Encoder & Decoder Online | WritoryBuzz
Free Tool · WritoryBuzz

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.

Text encode & decode
File to Base64 supported
URL-safe mode included
100% private, client-side only

Base64 Encoder / Decoder

Output format
Supports UTF-8 text, JSON, HTML, code snippets, email content — anything text-based.
Paste any standard or URL-safe Base64 string. Whitespace and line breaks are stripped automatically.
📂

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.

VariantCharacters 62–63PaddingUse Case
Standard Base64+ and /=Email, file encoding, general data
URL-safe Base64- and _OptionalURLs, JWTs, query parameters
MIME Base64+ and /= with line breaks at 76 charsEmail 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

Is Base64 the same as encryption?+
No. Base64 is an encoding scheme, not encryption. Anyone with a decoder can immediately recover the original data. It offers zero security or privacy protection. If you need to protect data, use a proper encryption algorithm such as AES. Base64 is purely for format compatibility — making binary data safe to transmit over text-based systems.
Why does Base64 output end with = or ==?+
Base64 processes input in groups of 3 bytes. If the input length is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4. One = means the last group had 2 bytes of real data; two == means the last group had only 1 byte. You will never see three = characters in valid Base64.
Does this tool send my data to a server?+
No. This tool runs entirely in your browser using JavaScript's built-in btoa() and atob() functions, with custom UTF-8 handling for Unicode text. Nothing you paste or upload is sent to any server. Your data never leaves your device. This is especially important when encoding credentials, private keys, or sensitive API tokens.
What is the maximum file or text size this tool supports?+
The tool enforces a 5 MB limit for file encoding. For text, there is no hard limit but very large inputs may cause the browser to slow down since all processing happens in the main thread. For files larger than 5 MB, consider a command-line tool: base64 filename.ext on Linux/macOS, or certutil -encode on Windows.
What is the difference between standard and URL-safe Base64?+
Standard Base64 uses + and / as its 62nd and 63rd characters. These are reserved characters in URLs, which causes errors when a standard Base64 string appears in a URL path or query parameter. URL-safe Base64 replaces + with - and / with _ so the string can be included in a URL without percent-encoding. JWTs always use URL-safe Base64.
How do I decode a JWT token?+
A JWT has three parts separated by periods: header.payload.signature. Copy the middle section (the payload) and paste it into the decode tab of this tool with URL-safe mode selected. The decoded output is the JSON claims object. Note that the signature section cannot be meaningfully decoded this way — it is a cryptographic value, not JSON.