Base64 File Encoder

File to Base64

Funnel mode keeps the selected file in this browser for up to two hours so it can move between steps. It is not uploaded.

Base64 turns any binary file into a string of printable ASCII that can travel through systems designed only for text: JSON, YAML, email bodies, SMS, copy-paste into a chat. This encoder accepts an arbitrary file, PDF, image, ZIP, even an executable, and returns the Base64 representation ready to drop into a data: URI, an API payload or a configuration file.

How to encode a file

  1. 1

    Drop any file into the encoder

    All binary formats work. The browser reads the raw bytes.

  2. 2

    The bytes are Base64-encoded

    Each three bytes become four ASCII characters from the alphabet `A-Z a-z 0-9 + /`.

  3. 3

    Pick the output wrapper

    Plain Base64, a `data:` URI with the MIME type reported by your browser (or a generic fallback), or a JSON string-safe version.

  4. 4

    Copy or download as text

    For large files, download as a `.txt`; for small ones, copy to clipboard.

Size overhead

Base64 inflates every three bytes to four characters, a 33% increase in storage and network cost. Padding with = adds a couple more bytes. For a rough estimate:

Input file size Base64 text size
1 KB 1.33 KB
100 KB 133 KB
1 MB 1.33 MB
10 MB 13.3 MB

Embedding large binary files as Base64 in HTML or JSON is a quick way to blow up page load and parser memory. Inline anything over about 10 KB only when the deployment constraint forces it.

Common use cases

  • Data URIs, Tiny inline images in CSS or HTML: url("data:image/png;base64,iVBORw0KGgo...").
  • Email attachments, MIME multipart bodies encode attachments in Base64 for SMTP-safe transport.
  • JSON payloads, Embedding a PDF or ZIP inside a JSON field for a single-request API.
  • YAML/config files, Shipping a TLS key or small binary blob inside a config.

Variants and padding

The standard RFC 4648 Base64 alphabet has 64 symbols: A-Z, a-z, 0-9, + and /. The = character is padding, not part of the alphabet. For URL-safe output (replaces + with - and / with _) use the dedicated URL-safe toggle. Padding is included by default and can be disabled.

Privacy note

The file never leaves your device. The FileReader API reads the bytes in-browser and JavaScript performs the encoding. This matters when encoding sensitive PDFs, private keys or unreleased assets.

Frequently Asked Questions

The encoder accepts one file up to 50 MB. Base64 output is larger than the source and is held in browser memory, so the hard limit protects the tab from excessive memory use.

Use it when an alphabet safe for URLs or filenames is required. URL-safe Base64 (RFC 4648 section 5) replaces + with - and / with _; the separate padding option controls whether trailing = characters are kept.

Only for data: URI output. A data:image/png;base64,... tells the browser how to render the decoded bytes. For plain Base64 or JSON embedding, the MIME type is not part of the encoded data.

HTML can contain a data:application/pdf;base64,... URL, but modern browsers commonly block top-level navigation to data: URLs and download behavior is not reliable across browsers. Large values can also hit URL, memory or Content Security Policy limits. For a dependable download, create a Blob/object URL in browser code or link to a hosted HTTPS file.

Related Tools