Base64Doc

Encode PDF Files to Base64 Online

100% Browser Local · 0 File Uploads · 100MB+ Ready

Select any local PDF, optionally trim unneeded pages before encoding, monitor the +33.3% payload expansion against Vercel and AWS limits, and copy API JSON snippets.

Try 1-Click Synthetic Samples (Zero-Trademark):

Drop any file, paste Base64, or press Ctrl/Cmd+V with clipboard files or raw API JSON

Runs inside a local Web Worker. Network tab stays at 0 file POST requests.

0 chars
Encoded Base64, Gateway Budget & Code Snippets Appear Here

Drop any local file up to 100MB+ or type UTF-8 text on the left. No data leaves your browser.

Interactive Synthetic Showcase Gallery

Load real client-side verified payloads straight into the workbench above. Zero third-party trademarks.

Free · InstantCASE-1

Shipping API JSON -> 2 Auto-Named PDFs + 180 deg Label Fix

Input Payload
Raw Shipping API JSON (4.8 KB)
Verified Output
waybill_label.pdf (4x6 in, 180 deg -> 0 deg) + commercial_invoice.pdf (A4, 2 pages)
Real browser-decoded output preview (client-side only)
Free · InstantCASE-2

ERP Payload -> PK\x03\x04 Verified 3-Sheet Excel Preview

Input Payload
ERP Base64 Payload (122.8 KB)
Verified Output
Summary (128 rows x 11 cols), LineItems (48 rows), Tax (24 rows) -> .xlsx / .csv / .json
Real browser-decoded output preview (client-side only)
Free · InstantCASE-3

Broken Data URI + MIME Fix + White Transparent Logo

Input Payload
Broken data:image/jpeg;base64 + \/ + newlines (4.9 KB)
Verified Output
Auto-fixed to image/png (512x512 px) + Checkerboard reveals white emblem
Real browser-decoded output preview (client-side only)
Free · InstantCASE-4

Gzip + Base64 Unpack & Korean EUC-KR Mojibake Self-Heal

Input Payload
Gzipped Base64 (212 chars) + EUC-KR Receipt
Verified Output
Gunzipped JSON + EUC-KR Hangul receipt recovered from UTF-8 replacement chars
Real browser-decoded output preview (client-side only)
Free · InstantCASE-5

40-Page Contract Slimming + Gateway Green-Light Check

Input Payload
40-Page Synthetic Contract PDF (33.7 KB)
Verified Output
Extract Page 1 -> +33.3% Base64 fits comfortably under 4.5 MB Vercel limit
Real browser-decoded output preview (client-side only)

Pre-Encode Page Slimming for Serverless Request Budgets

Trim a bloated multi-page PDF down to just the pages your webhook needs before +33.33% Base64 expansion triggers an HTTP 413 rejection.

Read full technical details

Serverless runtimes enforce strict synchronous request ceilings: Vercel Serverless Functions cap HTTP bodies at 4.5 MB (4,718,592 bytes), while AWS Lambda proxy integrations behind REST API Gateway reject bodies above 6 MB. Because Base64 maps every 3 binary bytes into 4 ASCII characters, any PDF larger than roughly 3.35 MB blows past a 4.5 MB limit once serialized inside JSON.

Rather than launching a desktop PDF editor to split pages manually, the Pre-Encode Slimming bar lets you pick exact page ranges such as 1-2 directly in the browser. Using pdf-lib, Base64Doc constructs a fresh minimal PDF containing only those selected pages and updates the projected encoded footprint in real time.

When even the trimmed pages stay red above 6 MB, the budget evaluator recommends switching from inline JSON Base64 to pre-signed object-storage uploads or multipart binary streams.

24-Bit-Aligned Web Worker Chunking for 100 MB+ PDFs

Encode massive architectural blueprints or scanned archives in 786 KB slices without freezing browser tabs or corrupting Base64 padding.

Read full technical details

Calling window.btoa() on a huge binary string forces JavaScript engines to allocate a single contiguous UTF-16 string and often hits memory ceilings or stalls the UI thread for seconds. Naive chunking introduces another fatal flaw: slicing at power-of-two boundaries like 65,536 bytes (not divisible by 3) injects illegal = padding characters in the middle of the stream.

Base64Doc reads local File blobs in 786,432-byte segments—exactly 262,144 three-byte groups—inside a dedicated Web Worker. Every intermediate slice maps cleanly to 1,048,576 Base64 characters with zero padding until the very final tail block.

Instead of dumping 135 million characters into an editable textarea, the UI renders a 4,096-character head and tail preview while keeping the full buffer ready for one-click clipboard copy or streaming .txt file download.

Ready-to-Run JSON Bodies, Data URIs & Multi-Language Snippets

Export raw RFC 4648 strings, data:application/pdf;base64 URIs, or ready-to-paste JavaScript, Python, Go, and Bash decoder blocks in one click.

Read full technical details

Different consumers expect different wrappers. HTML embed fixtures and offline test cases require a full data:application/pdf;base64, prefix; legacy SMTP attachments expect RFC 2045 MIME line breaks every 76 characters; and REST API test suites need a compact single-line string wrapped inside a JSON key.

Toggle those options above the output panel without re-reading the disk file, or switch to the Developer Export tabs to copy verified JavaScript, Python, C#, Go, Bash, or PowerShell snippets calibrated to your active alphabet and padding settings.

Step-by-Step Local Workflow

STEP 1

Load a Local PDF Without Uploading Bytes

Drag any .pdf file from disk into the dropzone or choose it locally; the encoder reads File.slice() ranges directly in memory with zero server transmission.

STEP 2

Optionally Slim Pages Before Encoding

If a 40-page scan exceeds your serverless request limit, specify a page subset like 1-3 in the Pre-Encode Slimming bar so pdf-lib strips unneeded pages before Base64 conversion.

STEP 3

Monitor Gateway Budget & Encoding Format

Inspect the exact post-expansion byte count against Vercel 4.5 MB, AWS REST 6 MB, and AWS HTTP 10 MB thresholds while toggling Raw RFC 4648, URL-Safe, MIME-76, or Data URI output.

STEP 4

Copy Snippet or Stream-Download .txt

Copy the full Base64 string, grab an API JSON request wrapper, or export a multi-megabyte .txt file via streaming Blob without freezing your browser DOM.

Technical Specification Summary

CapabilityBase64Doc BehaviorEngineering Notes
Worker Chunk Alignment786,432 bytes (3 x 256 KiB)Exact multiple of 3 prevents mid-file = padding between streamed chunks.
Deterministic Size Ratioceil(bytes / 3) x 4 (+33.33%)A 3.37 MiB raw PDF reaches ~4.50 MB before JSON field wrapping.
Pre-Encode Trimmingpdf-lib page subset extractionDiscards extraneous appendix pages locally before encoding bytes.
Textarea Virtualization4,096 head + 4,096 tail charsPrevents DOM reflow crashes on 100 MB+ encoded PDF documents.
Gateway Alert Thresholds4.5 MB / 6 MB / 10 MBGreen, yellow, and red badges warn before HTTP 413 failures occur.

Frequently Asked Questions

Why does a 3.6 MB PDF trigger an HTTP 413 error on a 4.5 MB API endpoint after encoding?

Base64 expands binary bytes by 4/3 (+33.33%), turning a 3.6 MB PDF into roughly 4.8 MB before JSON keys are added. Trim unneeded pages with the built-in slimmer first so the encoded payload stays under 4.5 MB.

Will encoding a 100 MB scanned PDF lock up my browser tab?

No, chunked encoding processes 786,432-byte blocks inside a Web Worker and virtualizes the preview to 4,096 head and tail characters. You can copy the complete payload or stream-save a .txt file without UI lag.

Why must PDF streaming chunks be divisible by 3 bytes?

Every 3 binary bytes (24 bits) encode cleanly into 4 Base64 characters without = padding. Using 786,432-byte slices guarantees valid concatenated Base64 output across chunks.

Should I enable MIME 76-character wrapping when sending a PDF inside JSON?

No, omit 76-character line breaks for JSON API payloads because embedded CRLF characters add ~2.6% unnecessary overhead and break strict single-line token parsers. Reserve MIME-76 for raw .eml email bodies.

Can I generate a data:application/pdf;base64 Data URI directly from this page?

Yes, enable the Data URI prefix toggle or select the Data URI snippet tab below the output box to copy the RFC 2397 string with application/pdf.

Explore All 34 Base64 Converters & Developer Tools