Developer Tools · Encode/Decode

ToolAdda

Base64 Encoder & Decoder

Encode or decode Base64 with live auto-detection, full UTF-8/Unicode support, URL-safe mode, drag-and-drop files, JSON/XML pretty-print, and batch ZIP export — all processed privately in your browser.

Nothing is uploaded. Every encode and decode runs locally in your browser — your data never leaves this device.
🔒 No server upload 🧬 Unicode safe 📦 Batch + ZIP 🆓 Free forever

Convert Base64Live

Type text, paste Base64, or switch to File / Image to upload, drag & drop, paste, or import from a URL. Output updates as you type.

1 Input 2 Mode 3 Convert 4 Copy / Download
0 chars · 0 B Undo/redo: Ctrl+Z / Ctrl+Shift+Z
0 chars · 0 B
Output size0 B
Size change
Processed in
Paste a Base64 string to validate it.

Recent Conversions

Stored only in your browser's local storage — never sent anywhere. Click any entry to reload it.

    Features

    Everything a Developer Needs, Built In

    🪄 Auto-detect mode

    Paste anything and the tool figures out whether to encode or decode — no mode-switching required.

    🧬 True Unicode/UTF-8

    Built on TextEncoder/TextDecoder, so emoji and non-Latin scripts round-trip correctly, unlike escape()-based tools.

    🔗 URL-safe Base64

    One toggle switches between standard (+/) and URL-safe (-_) alphabets, decoding accepts either automatically.

    🖼️ Image ⇄ Base64

    Drag in an image to encode it, or paste Base64 to instantly preview and download the decoded image.

    📁 Any file type

    PDFs, fonts, ZIPs, audio — Base64 works on raw bytes, and this tool sniffs the type automatically on decode.

    ✅ Base64 validator

    Get a precise pass/fail verdict with the exact reason a string is invalid, instead of a silent failure.

    🧹 Pretty & minify

    Decoded JSON, HTML, XML, and SVG can be reformatted or compacted in one click.

    📦 Batch + ZIP export

    Encode a whole folder of files at once and download every result together as a ZIP.

    🕓 History & undo/redo

    Recent conversions are saved locally for reuse, and input changes support full undo/redo.

    📋 Clipboard image support

    Paste an image straight from your clipboard, or copy a decoded image back to it.

    ⌨️ Keyboard-first

    Encode, decode, copy, clear, swap, and undo — all reachable without touching the mouse.

    🔒 Zero-upload architecture

    Every byte is processed with native browser APIs on your device. Nothing is sent to ToolAdda's servers.

    Use cases

    Where Developers Actually Use Base64

    🌐 REST & GraphQL APIs

    Embedding binary payloads (images, files) inside JSON request/response bodies.

    🖼️ Data URIs

    Inlining small images and fonts directly into HTML or CSS to cut HTTP requests.

    📧 Email attachments

    MIME-encoding binary files so they survive transport over 7-bit-safe SMTP.

    🔐 Auth headers & JWTs

    HTTP Basic Auth credentials and the header/payload segments of JSON Web Tokens.

    ⚙️ Config & env vars

    Storing certificates, keys, or small binary blobs safely in .env files or CI secrets.

    🗄️ Databases

    Persisting binary data in text-only columns or NoSQL documents.

    🧾 Webhooks

    Passing file payloads through systems that only accept JSON text bodies.

    🧪 Debugging

    Quickly inspecting what a Base64 blob in a log file, cookie, or request actually contains.

    Privacy

    Privacy-First by Architecture

    ToolAdda's Base64 Studio is built so there is nothing to leak: encoding and decoding happen entirely inside your browser tab using standard Web APIs (TextEncoder, TextDecoder, atob, btoa, FileReader). No text, file, or image you process is ever transmitted to ToolAdda or any third party.

    🚫 No uploads

    Your input never leaves the browser tab it's typed or dropped into.

    🗃️ No server storage

    There is no backend database — ToolAdda cannot retain what it never receives.

    🙅 No account needed

    Use every feature immediately, with no sign-up, email, or tracking gate.

    ♾️ Unlimited usage

    No conversion caps, watermarks, or paywalled features.

    Important distinction: Base64 is not encryption and provides no confidentiality — it is a text-safe encoding, fully reversible by anyone. If you need to protect sensitive data, encrypt it first (e.g. AES) and use Base64 only to make the resulting ciphertext transportable as text.

    Complete guide

    The Complete Guide to Base64 Encoding

    What Is Base64 Encoding?

    Base64 is a binary-to-text encoding scheme defined by RFC 4648 that represents any sequence of bytes using only 64 printable ASCII characters: uppercase letters A–Z, lowercase letters a–z, the digits 0–9, and two extra symbols (+ and / in the standard alphabet). It exists to solve one specific problem: many systems — email, JSON, XML, URLs, older network protocols — were designed to carry plain text safely, but binary data (images, PDFs, compressed archives, raw cryptographic bytes) can contain byte values that those systems misinterpret, strip, or corrupt in transit. Base64 re-packages arbitrary bytes into a character set that is safe everywhere plain text is safe.

    It's worth being precise about what Base64 is not: it is not compression (the output is roughly 33% larger than the input, never smaller), it is not encryption (there is no key and no secrecy), and it is not a hash (it's fully reversible, not a fixed-size fingerprint). It is simply a reversible re-encoding of bytes into text.

    How Base64 Encoding Works, Step by Step

    Base64 works on 3-byte (24-bit) groups of input, because 24 is the smallest number divisible by both 8 (bits per byte) and 6 (bits per Base64 character). Each 24-bit group is split into four 6-bit chunks, and each 6-bit chunk (a value from 0–63) is mapped to one character in the Base64 alphabet:

    Input bytes (3 bytes / 24 bits):   01001101 01100001 01101110
    Regrouped into 6-bit chunks:       010011 010110 000101 101110
    Base64 character indices:          19     22     5      46
    Base64 output:                     T      W      F      u
    Result: "Man" → "TWFu"

    When the input length isn't a multiple of 3 bytes, the final group is padded with zero bits and the output is padded with one or two = characters to signal how many "extra" bytes were added — this is why you'll often see Base64 strings ending in = or ==. URL-safe Base64 commonly omits this padding since the original length can be inferred by the decoder.

    Base64 Encoding vs. Encryption vs. Hashing

    These three concepts get confused constantly, and mixing them up is a genuine security risk (storing a Base64-encoded password and calling it "encrypted" is a real, recurring mistake). Here's the distinction:

    PropertyBase64 EncodingEncryption (e.g. AES)Hashing (e.g. SHA-256)
    PurposeSafe text transportConfidentialityIntegrity / fingerprinting
    Reversible?Yes, alwaysYes, with the keyNo, one-way by design
    Requires a key?NoYesNo (usually)
    Output size vs input~133%~100–110%Fixed size, any input
    Hides the content?No — trivially reversibleYes, without the keyYes, but can't recover original

    When (and When Not) to Use Base64

    Use Base64 when you need to move binary data through a text-only channel: embedding a small image directly in HTML/CSS as a Data URI, attaching a file to an email, sending binary payloads inside JSON, or storing a certificate in a plain-text config file. Avoid it when a native binary channel already exists and is more efficient — for example, uploading a large file via multipart/form-data or a binary API body is almost always better than Base64-encoding it into a JSON string first, both because you skip the 33% size penalty and because you avoid holding the entire encoded string in memory at once.

    Base64 in APIs, JSON, XML, and HTML

    JSON and XML have no native binary type, so any API that needs to transmit binary data as part of a structured document — a profile photo in a user object, a signature image in a form submission, a file attachment in a webhook payload — typically Base64-encodes it into a string field:

    {
      "filename": "avatar.png",
      "contentType": "image/png",
      "data": "iVBORw0KGgoAAAANSUhEUgAA..."
    }

    In HTML and CSS, Base64 commonly appears inside a Data URI, which lets you inline an image, font, or icon directly into a document instead of linking to a separate file:

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." alt="Inline icon" />
    
    .icon {
      background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0i...);
    }

    This tool's File / Image tab generates exactly that Base64 payload — grab the output and wrap it in data:<mime-type>;base64, to build a Data URI by hand, or use the live preview to confirm the encoding round-trips correctly first.

    UTF-8, Unicode, and a Common Base64 Bug

    Base64 itself only knows about bytes — it has no concept of "characters." So before you can Base64-encode a piece of text, you first have to decide how that text becomes bytes, and that decision is a character encoding, almost always UTF-8 today. A surprisingly common bug happens when developers reach for JavaScript's native btoa()/atob() directly on a string: these functions only understand Latin1 (one byte per character) and throw or silently corrupt output on any character above code point 255 — which includes emoji, most non-Latin scripts, and even "smart quotes." The classic workaround, btoa(unescape(encodeURIComponent(str))), works but relies on the deprecated escape()/unescape() functions. This tool avoids all of that by using the modern TextEncoder/TextDecoder APIs internally, so text containing emoji, Hindi, Japanese, Arabic, or any other Unicode script encodes and decodes correctly every time.

    URL-Safe Base64 Explained

    The standard Base64 alphabet includes + and /, both of which are reserved characters inside URLs (+ often means "space," / separates path segments). Passing standard Base64 in a query string or filename without extra percent-encoding is a reliable way to break things. URL-safe Base64 (RFC 4648 §5) swaps +- and /_, and typically drops the = padding entirely, producing a string that's safe to use directly in URLs, filenames, and cookies. It's the variant used inside JWTs (JSON Web Tokens) for exactly this reason. This tool's URL-safe toggle switches the output alphabet on encode; decoding accepts both flavors automatically, so you never have to manually convert between them first.

    Common Base64 Errors and How to Fix Them

    • "Invalid character" errors — usually caused by line breaks, quotes, or whitespace accidentally copied along with the Base64 string (common when copying from an email client or a PDF).
    • Wrong or missing padding — the decoded length isn't a multiple of 4; this tool's normalizer re-pads automatically, but hand-written decoders often don't.
    • Mixing standard and URL-safe characters — a string containing both +// and -/_ is not valid in either alphabet and needs to be re-checked at the source.
    • Double-encoding — Base64-encoding an already-encoded string produces a valid-looking but semantically wrong result; if decoded output still looks like Base64, decode it again.
    • Encoding a string without specifying UTF-8 — see the Unicode section above; this is the single most common cause of "my emoji turned into garbage" bug reports.

    Security Considerations

    The most important security fact about Base64 is the one worth repeating: it provides no confidentiality. It's reversible by design, with no secret involved, so a Base64 string is exactly as sensitive as the plaintext it encodes — treat ZG9udCBzdG9yZSBzZWNyZXRzIGxpa2UgdGhpcw== the same as you'd treat the decoded sentence sitting in a log file. Storing passwords, API keys, or PII as "just Base64" and considering that secure is a real, documented class of vulnerability. If you need confidentiality, encrypt first with an authenticated cipher and Base64-encode the ciphertext only for transport.

    Performance Considerations for Large Files

    Because everything in this tool runs client-side, performance is bound by your device rather than a server queue — but a few practical limits still apply. Base64 output is always ~33% larger than input, so a 30 MB file becomes roughly 40 MB of text; browsers can comfortably handle this for typical file sizes, but very large files (several hundred MB) will use proportionally more memory and take longer to process. This tool processes file bytes in chunks to avoid call-stack limits on large arrays, and keeps live text processing debounced so typing stays responsive even with sizeable input.

    Browser Compatibility

    Every feature here — TextEncoder/TextDecoder, atob/btoa, the File and Blob APIs, drag-and-drop, and the Clipboard API — is a stable, broadly supported Web Platform feature available in all current versions of Chrome, Edge, Firefox, and Safari on both desktop and mobile. Copy-to-clipboard for images specifically requires the newer ClipboardItem API, which has slightly narrower support; where it's unavailable, the Download button works as a universal fallback.

    Best Practices for Developers

    • Always specify a character encoding (UTF-8) explicitly when converting strings to bytes before Base64-encoding — never rely on implicit Latin1 behavior.
    • Use the URL-safe alphabet for anything that lands in a URL, filename, cookie, or JWT segment; use the standard alphabet for Data URIs and MIME email.
    • Don't Base64-encode large binary payloads inside JSON if a native binary upload path (multipart, raw body) is available — you'll save both bandwidth and memory.
    • Validate untrusted Base64 input before decoding it server-side, and always enforce a maximum decoded size to avoid memory-exhaustion attacks from an oversized string.
    • Never treat Base64 as a security boundary — pair it with real encryption whenever confidentiality matters.

    Why Choose ToolAdda's Base64 Studio

    CapabilityToolAddaTypical single-purpose tools
    Text, JSON, HTML, XML, SVG, image & file support✅ All in one workspaceOften text-only
    Correct UTF-8 / emoji handling✅ TextEncoder-basedFrequently broken on emoji
    URL-safe mode✅ One toggleRarely offered
    Live image & file preview on decodeRare
    Batch encode + ZIP exportRare
    Validator with a specific failure reasonUsually a generic error
    Data leaves your deviceNeverVaries — some tools upload
    Account or sign-up requiredNeverSometimes

    Keyboard Shortcuts

    Ctrl + EnterRun the current mode (auto / encode / decode)
    Ctrl + Shift + CCopy output
    Ctrl + Shift + XClear input and output
    Ctrl + Shift + SSwap input and output
    Ctrl + ZUndo input change
    Ctrl + Shift + ZRedo input change
    Ctrl + VPaste text or an image from your clipboard

    On macOS, use Cmd in place of Ctrl.

    FAQ

    Frequently Asked Questions

    What is Base64 encoding?

    Base64 represents binary data — images, files, or raw bytes — using only 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It exists because many text-based systems (email, JSON, XML, URLs) can't safely carry arbitrary binary bytes, so Base64 re-packages that data as plain text any system can transport without corruption.

    Is Base64 a form of encryption?

    No. Base64 is encoding, not encryption — it uses no secret key and provides zero confidentiality. Anyone can decode a Base64 string instantly, including this tool. Use real encryption (AES, TLS) to protect sensitive data, and Base64 only to make the resulting bytes transportable as text.

    Is my data uploaded to a server?

    No. Every encode/decode runs locally in your browser using native JavaScript APIs. Nothing you type or upload is transmitted anywhere — the one exception is the optional Import from URL feature, which fetches directly from the URL you provide.

    Does this tool support Unicode, emoji, and non-Latin scripts?

    Yes. Text is encoded as UTF-8 bytes using the browser's native TextEncoder/TextDecoder before Base64 encoding, so emoji, accented letters, Hindi, Chinese, Arabic, and any other Unicode text round-trip correctly — unlike tools built on the deprecated escape()/unescape() trick.

    What is URL-safe Base64 and when do I need it?

    Standard Base64 uses + and /, which have special meaning inside URLs. URL-safe Base64 replaces + with -, / with _, and typically omits = padding. Use it for URLs, filenames, cookies, and JWT segments; use standard Base64 for Data URIs and MIME email.

    Why does Base64 make my output about 33% larger?

    Base64 packs every 3 bytes of input into 4 output characters (6 bits per character instead of 8). That fixed 4:3 ratio is where the ~33% overhead comes from — it's mathematically unavoidable, the trade-off for safe, universal text transport.

    Can I convert an image to Base64?

    Yes. Switch to File / Image, then drag & drop, browse, paste from your clipboard, or import from a URL. The tool encodes the raw bytes and shows a live preview so you can confirm it before copying the string.

    Can I convert Base64 back into a downloadable image or file?

    Yes. Paste a Base64 string and the tool decodes the bytes, detects the file type from its binary signature, shows an image preview when applicable, and lets you download the result in one click.

    What file types are supported?

    Any file type, since Base64 works on raw bytes. This tool adds smart handling for JSON, XML, HTML, CSS, JavaScript, and SVG, plus binary signature detection for PNG, JPEG, GIF, BMP, ICO, WebP, PDF, ZIP, and GZIP.

    Is there a file size limit?

    No artificial limit. Since everything runs on your own device, the practical ceiling is your browser tab's available memory — large files simply take longer and use more RAM.

    Does this tool work offline?

    Once the page has loaded, all encoding/decoding logic runs locally and needs no network connection — only Import from URL inherently requires connectivity.

    Can I encode or decode JSON, XML, HTML, CSS, or SVG specifically?

    Yes. Paste any of these as text and encode normally. On decode, the tool recognizes JSON, XML, HTML, and SVG automatically and offers Pretty/Minify, with SVG output also rendering as a live image preview.

    What's the difference between standard and URL-safe Base64?

    Same underlying bytes, different character set: standard uses + and / with = padding; URL-safe substitutes - and _ and usually drops padding. This tool's toggle controls the encode output; decoding accepts either automatically.

    Why did decoding fail with an "Invalid Base64" error?

    Common causes: characters outside A–Z, a–z, 0–9, +, /, -, _ (often stray line breaks or quotes); a length that isn't a multiple of 4 after removing whitespace; or missing/incorrect padding. Click Validate for a specific diagnosis.

    Can I batch-convert multiple files at once?

    Yes. Drop or select multiple files and each is encoded independently into a queue — click any item to load it, copy its Base64, or download every result together as a ZIP.

    Does this tool keep a history of my conversions?

    Yes, a short local history of recent text conversions is kept in your browser's localStorage for convenience — it never leaves your device, caps at 15 entries, and can be cleared anytime.

    Can I copy a decoded image directly to my clipboard?

    Yes, in browsers supporting the Clipboard API's ClipboardItem (current Chrome, Edge, Safari). Use Copy Image next to the preview; Download works everywhere as a fallback.

    What keyboard shortcuts are available?

    Ctrl/Cmd+Enter runs the current mode, Ctrl/Cmd+Shift+C copies output, Ctrl/Cmd+Shift+X clears everything, Ctrl/Cmd+Shift+S swaps input/output, and Ctrl/Cmd+Z / Shift+Z undo and redo.

    Can I paste an image directly from my clipboard?

    Yes. Copy an image anywhere, click into the page, and press Ctrl+V (Cmd+V on Mac) — it's detected as a file and encoded automatically.

    Can I import a file directly from a URL?

    Yes, via the Import from URL field. This depends on the target server allowing cross-origin requests (CORS); if it blocks them, download the file yourself and drag it in instead — a browser security restriction, not a tool limitation.

    Does Base64 work the same in every programming language?

    The core RFC 4648 algorithm is universal — a string encoded in JavaScript decodes identically in Python, Java, Go, or PHP. What differs is API defaults: some languages default to URL-safe encoding, strip padding, or require explicit UTF-8 handling.

    Why do email attachments use Base64?

    SMTP was designed for 7-bit ASCII text and can corrupt raw binary in transit. MIME email wraps attachments in Base64 so every mail server can relay them safely as text, and the receiving client decodes them back to the original file.

    What's the difference between Base64 and hashing (MD5/SHA-256)?

    Base64 is fully reversible — you can always recover the original bytes. Hashing is one-way and produces a fixed-size fingerprint that cannot be reversed. Base64 is for safe transport; hashing is for integrity checks and password storage.

    Can I use this for Basic Auth headers or JWT segments?

    Yes, for understanding and debugging — Basic Auth sends "username:password" Base64-encoded (not encrypted), and JWTs are three Base64URL segments joined by dots. To build or verify a signed JWT, use ToolAdda's dedicated JWT Encoder and JWT Debugger.

    Does encoding or decoding change my original file?

    No. Base64 is lossless in both directions — decoding a correctly encoded string reconstructs the exact original bytes with no quality loss or corruption.

    Is this tool free, and is there a usage limit?

    Yes, completely free with no sign-up, watermark, or usage cap. Since processing happens on your own device, there's no server quota to run into.

    Does this work on mobile devices?

    Yes. The interface is fully responsive and touch-friendly, with a tap-to-browse upload flow and a sticky action bar for quick access on small screens.

    Why do some Base64 strings end with = or == ?

    Base64 processes input in 3-byte groups. When the final group has only 1 or 2 bytes, padding characters (= or ==) keep the output length a multiple of 4. URL-safe Base64 commonly omits this padding entirely.

    Explore more

    Ready to Encode or Decode Base64?

    Text, JSON, images, or any file — convert it privately in your browser, free and unlimited.

    ⚡ Open the Base64 Studio
    Base64 Studio