Back to Toolbox

Base64 Encoder / Decoder

Convert text strings to Base64 standard ASCII formatting or reverse decode them back.

Tool Documentation & Usage Guide

What Base64 Actually Is (and Is Not)

Base64 is a binary-to-text encoding scheme that represents binary data using a safe subset of 64 ASCII characters (A–Z, a–z, 0–9, +, /, and = for padding). It was designed for one job: move arbitrary bytes through systems that were built to carry text — email (SMTP), URLs, XML, JSON, and CSS. The moment you need to stuff a PNG or a certificate into a place that only understands text, Base64 is the bridge.

The single most common misconception is that "Base64 = encryption." It is not. There is no key, no secret, and no math that protects the data. Base64 is a reversible mapping, exactly as public as hex. Anyone who sees a Base64 string can decode it in one line of code. Never treat Base64 output as a way to hide a password, an API key, or a token.

Why Use Base64 Encoding?

  • Data Integrity through text-only channels: Binary bytes (values above 127) get mangled by legacy text systems. Base64 collapses everything into 64 benign characters that survive email relays, terminal copy-paste, and JSON fields untouched.
  • Self-contained assets: Embedding a tiny favicon or a web-font subset directly inside a CSS url(data:...) removes a network round-trip and cuts render-blocking requests.
  • Standard interop: JWTs, PEM certificates, and many API payloads carry Base64URL-encoded segments by specification — you cannot avoid understanding it if you touch auth or crypto.

The 33% Size Penalty, Explained

Base64 packs 3 source bytes (24 bits) into 4 output characters, each carrying 6 bits. Four output bytes now represent three input bytes, so the encoded form is 4/3 ≈ 1.333× the original size — a precise 33.33% inflation. There is no compression happening; it is pure representation overhead. For a 9 KB icon that is a 3 KB tax worth paying to avoid an extra HTTP request. For a 4 MB photo, it is 1.3 MB of bloat that will hurt your Largest Contentful Paint. Rule of thumb: inline under ~10 KB, link everything larger.

Unicode, Emojis, and the btoa() Trap

JavaScript's native btoa() only accepts Latin-1 binary strings (one byte per character, 0–255). Feed it "你好" or "🚀" and it throws InvalidCharacterError. Our tool avoids this by first running the input through encodeURIComponent(), then mapping each percent-encoding back to a single byte before Base64. The result is fully Unicode-safe and decodes back to the exact original string. If you decode elsewhere, remember: you must reverse the URI step too, or you will get mojibake.

When (and When Not) to Inline Base64

Use inline Base64 for small, rarely-changing assets that block rendering: icons, spinner GIFs, a logo in an email template. Avoid it for large images, for anything you want the browser to cache independently, or for above-the-fold hero photos — embedded blobs defeat parallel downloading and bloat your HTML/CSS parse time. Also note that Base64 images cannot be progressively rendered and ignore HTTP caching, so they are a net loss at scale.

Frequently Asked Questions

Q: Why does Base64 encoding increase file size by 33%?
A: Base64 maps every 3 bytes (24 bits) of raw binary data into 4 ASCII characters (4 bytes of 6 bits each). Because 4 bytes are used to represent 3 bytes of original data, the data size increases by exactly 33.33%.

Q: Is Base64 encoding secure for passwords or private data?
A: No. Base64 is an encoding format, not an encryption method. Anyone can easily decode a Base64 string back to its original format instantly without a password. Do not use Base64 to secure sensitive credentials.

Q: How does Base64 handle Unicode and special characters?
A: Standard JavaScript btoa() only supports binary strings (each character representing 1 byte, values 0-255). To encode Unicode characters (such as Chinese or Emojis), our tool first URI-encodes the string, converts the percent-encodings back into binary characters, and then performs Base64 conversion. This guarantees full Unicode safety.

Q: When should I embed Base64 assets in HTML or CSS?
A: Embedding is ideal for very small icons or fonts (under 10KB) to eliminate the round-trip latency of additional HTTP requests. However, avoid embedding large images as they prevent parallel loading and increase style parsing times.

Q: How does this Base64 tool keep my data private?
A: The conversion runs entirely in your browser using JavaScript. No text is ever sent to any server, so nothing you type or paste can be logged, stored, or leaked. Nothing you type is stored on our side — which is also why the tool keeps working offline.

How This Tool Works

This tool runs entirely in your web browser through Plobi-kit's 100% client-side architecture. No text data is sent to external web servers, guaranteeing complete privacy and offline utility capability. Want proof? Open your browser's Network tab, paste anything, and watch: nothing leaves your machine except the page's own assets.