Base64 ↔ PDF

Encode a PDF to Base64 or decode Base64 back to a PDF — standard or URL-safe, with an optional data-URL prefix — locally in your browser.

  • Runs locally in your browser
  • No upload required

Capabilities

  • Drag and drop
  • Local file intake
  • Download result

Try it

Read locally in your browser; never uploaded.

Used only in decode mode; whitespace and a data-URL prefix are accepted.

Choose a PDF, then run the tool. Everything happens in your browser.

Supported formats

Input
application/pdf, text
Output
text, application/pdf
Files
Local file intake and drag/drop

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Converted bytes to Base64: 53 byte(s); the result starts with %PDF-.

How it works

  • Decode the source bytes with the dependency-free codec.
  • Re-encode the result in the standard alphabet.
  • Check the decoded bytes for the %PDF- header and report the exact byte length.
  • No PDF object parsing is performed; the bytes are copied unchanged.

Methodology

  1. Encode: read the local PDF bytes and emit Base64 in the standard or URL-safe alphabet, optionally with a data-URL prefix.
  2. Decode: decode the Base64 with a strict, dependency-free RFC 4648 decoder; malformed input is a named finding.
  3. Check the decoded bytes for the %PDF- magic and report the exact byte length, never guessing the file type.

Usage

  1. Choose whether to encode a PDF or decode Base64.
  2. Pick the alphabet and whether to include a data-URL prefix.
  3. Run the conversion to copy or download the result.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

Encode a minimal PDF to Base64

jsonSelect to copy
{
  "mode": "encode",
  "data": "JVBERi0xLjQKJcOkw7zDtsOfCjEgMCBvYmoKPDwvVHlwZSAvQ2F0YWxvZz4+CmVuZG9iago=",
  "alphabet": "standard",
  "dataUrlPrefix": false
}

Decode Base64 to bytes

jsonSelect to copy
{
  "mode": "decode",
  "data": "JVBERi0xLjQKJcOkw7zDtsOfCjEgMCBvYmoKPDwvVHlwZSAvQ2F0YWxvZz4+CmVuZG9iago=",
  "alphabet": "standard",
  "dataUrlPrefix": false
}

Limitations

A faithful, local conversion

Encoding and decoding use a strict RFC 4648 codec. In encode mode the bytes are copied unchanged; in decode mode a malformed string is reported by name instead of silently dropping characters.

The tool checks the decoded bytes for the %PDF- magic so a non-PDF payload is labelled honestly.

Frequently asked questions

Is my PDF uploaded?
No. The bytes are read and converted locally in your browser; nothing is uploaded, stored or logged.
Which alphabets are supported?
Standard Base64 and its URL-safe variant (RFC 4648), with an optional `data:application/pdf;base64,` prefix.

Sources

  1. RFC 4648 — The Base16, Base32, and Base64 Data Encodings — IETF
  2. ISO 32000-1 — Document management — Portable document format (PDF 1.7) — ISO