Skip to main content
Utility Tools

Base64 Encoder / Decoder

Encode text or files to Base64, decode Base64 strings back to text or binary.

No upload — your files never leave your device

  • 100% private
  • Runs in your browser
  • Works offline
  • No sign-up
20 chars

About Base64

Base64 encodes any text or file into the ASCII-safe Base64 representation used in data URIs, email attachments, JWT payloads and embedded HTTP bodies. The decoder accepts both standard and URL-safe alphabets and auto-detects which one you've pasted. File mode handles up to a few hundred megabytes (your device's memory is the only ceiling) and emits a ready-to-use `data:` URI. It runs entirely client-side using the browser's native TextEncoder and FileReader APIs — no upload, no round-trip latency.

  • No uploads
  • Browser-only
  • Works offline
  • 100% free

How it works

  1. 1

    Pick text or file mode

    Text mode encodes a string with the native browser TextEncoder. File mode reads a file with FileReader as a binary blob.

  2. 2

    Encode or decode

    Encoding produces standard or URL-safe Base64 (your choice). Decoding accepts either alphabet and ignores whitespace, line breaks and PEM headers automatically.

  3. 3

    Copy or download

    For text, copy the Base64 with one click. For files, download the result as a .txt or paste it as a data: URI directly into HTML or CSS.

What Base64 is — and the thing people keep mistaking it for

Base64 is a binary-to-text encoding: it maps arbitrary bytes onto a 64-character alphabet (A–Z, a–z, 0–9, and two symbols) so that data which might contain control characters or bytes a text channel would mangle can travel safely as plain ASCII. That's its entire job. The standard is defined in RFC 4648, and email attachments, data URIs, and JWT segments all lean on it for exactly this reason — to move bytes through systems built for text.

The persistent misconception is that Base64 is a form of security. It is not. There is no key, no secret, and no protection — anyone can decode a Base64 string instantly with a one-line command, and this very tool decodes it for you. Putting a password or an API key in Base64 'to hide it' protects nothing; it's reversible obfuscation at best. If you need confidentiality, you need actual encryption such as AES; if you need an irreversible fingerprint, you need a hash. Base64 is encoding, full stop.

The 33% size overhead, and where it matters

Base64 represents every 3 bytes of input as 4 ASCII characters, which makes the output about 33% larger than the original — a 90 KB image becomes roughly 120 KB of text, plus a few bytes of = padding to round the length to a multiple of four. That tax is the price of text-safety and it's usually fine, but it changes the maths in two places. First, embedding images as data URIs in CSS or HTML inlines that inflated payload into every page load and defeats browser caching, so it only pays off for tiny, frequently-reused assets (a 1 KB icon), not photographs. Second, Base64-encoding a multi-gigabyte file to paste somewhere will balloon it by a third and can run a browser tab out of memory — for huge files a streaming command-line tool is the right call, not a web page.

Standard vs URL-safe, and why the difference exists

Standard Base64 uses + and / as its last two alphabet characters and = for padding. The problem is that all three are special in other contexts: + means space in form-encoded URLs, / is a path separator, and = is a query delimiter — so a standard Base64 string dropped into a URL or filename gets corrupted or needs percent-escaping. The URL-safe variant defined in RFC 4648 §5 swaps + for - and / for _, and padding is often omitted entirely, so the result drops cleanly into URLs, filenames, and the dot-separated segments of a JWT without further escaping. This decoder auto-detects which alphabet you've pasted and ignores stray whitespace, line breaks, and PEM-style header lines, so round-tripping either variant just works.

Practical uses, and where to reach for a neighbour instead

  • Data URIs — inline a small icon or font as data:image/png;base64,… to save an HTTP request, but only for tiny, cache-insensitive assets given the 33% bloat.
  • Embedding binary in text-only fields — a JSON value, a YAML config, a shell heredoc, an email MIME body — anywhere raw bytes would break the format.
  • Inspecting a JWT — the header and payload are URL-safe Base64, so decoding them reveals the claims; but to verify the signature, use the JWT tool, since Base64 alone proves nothing about authenticity.
  • Not for percent-encoding a query string — that's a different transform; reach for URL encoding instead. And not for compression — Base64 makes data bigger, never smaller.

Frequently asked questions about Base64

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

    Standard Base64 uses + and / in the alphabet, plus = for padding. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _ so the result can be dropped into URLs, filenames and JWT segments without percent-encoding. The decoder accepts both alphabets and strips padding automatically.

  • Is there a file size limit?

    No artificial limit. Base64 expands binary data by 4/3, so a 100 MB file becomes a ~133 MB string. That's fine for most browsers, but very large files can run your tab out of memory — for multi-gigabyte files you're better off using a streaming command-line tool.

  • Can I encode binary data, not just text?

    Yes. Switch to File mode and drop any file — images, PDFs, ZIPs, executables. The output is the exact bytes encoded as Base64, ready to embed in a JSON field, data URI or shell heredoc. The MIME type for data URIs is sniffed from the file extension.

Privacy, offline use, browser support, and pricing questions are answered on the site-wide FAQ.

See all Developer tools