Base64Doc

Encode JSON Payloads to Base64 Strings

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

Paste JSON objects or upload .json files to generate clean UTF-8 Base64 or unpadded URL-Safe tokens with instant code snippets and size checks.

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)

Solving JavaScript btoa() Unicode Crashes on JSON Strings

Encode international customer names, currency symbols, and emoji inside JSON cleanly via UTF-8 byte streams instead of crashing native window.btoa().

Read full technical details

JavaScript’s legacy window.btoa() expects binary strings whose character codes stay strictly within 0–255 (Latin1). The instant a JSON payload contains a Korean syllable, Japanese character, euro sign, or emoji, btoa(JSON.stringify(obj)) throws DOMException: The string to be encoded contains characters outside of the Latin1 range.

Base64Doc encodes every text input through TextEncoder("utf-8") into a real Uint8Array byte buffer before running chunked Base64 translation—matching Python, Go, and Node.js Buffer.from(str, "utf8").toString("base64") behavior identically.

Safe URL-Safe Pagination Cursors, Cookies & HTTP Headers

Generate unpadded Base64URL tokens from JSON state objects so query parameters never corrupt + into spaces or split on =.

Read full technical details

Passing Base64-encoded JSON pagination cursors or OAuth state in URLs breaks when standard + turns into a space inside form-urlencoded query strings and trailing = confuses query splitters. Toggling URL-Safe and Omit Trailing = produces clean header- and URL-safe Base64URL immediately.

Encoding Large Service Configs & JSON Exports Locally

Drop multi-megabyte .json fixture files directly into the Web Worker encoder with virtualized preview and gateway size alerts.

Read full technical details

Whether preparing a Kubernetes config map or encoding mock webhook bodies for CI, removing indentation spaces before encoding trims 15%–35% off final Base64 length.

Step-by-Step Local Workflow

STEP 1

Paste JSON Object or Drop a .json File

Insert formatted or minified JSON strings—even objects containing Korean, Japanese, Arabic, or emoji characters—or choose a local .json file.

STEP 2

Encode via True UTF-8 Byte Streams

Base64Doc serializes text with TextEncoder into UTF-8 octets prior to chunked Base64 encoding so Unicode code points above U+00FF never fail.

STEP 3

Choose Standard or URL-Safe Header Token Mode

Toggle RFC 4648 §5 (-_) and Omit Trailing = when placing encoded JSON inside query strings, cookies, or X-Custom HTTP headers.

STEP 4

Copy Encoded Token or Code Snippets

Copy the Base64 string or switch to JavaScript, Python, Go, or PowerShell tabs showing exact UTF-8-safe encoding idioms.

Technical Specification Summary

CapabilityBase64Doc BehaviorEngineering Notes
Unicode SafetyTextEncoder UTF-8 (No btoa bug)Handles emoji and CJK values without InvalidCharacterError exceptions.
Cursor / Header FormatRFC 4648 §5 + No = PaddingPrevents +, /, and = from breaking URL query parameter parsing.
Whitespace Trade-OffMinified JSON saves 15%–35%Compact single-line JSON avoids encoding indentation spaces as Base64.
Output PrefixeyJ... (for {"...})Standard JSON object encodings open cleanly with eyJ.
Client Privacy100% browser-local RAMService-account manifests and OAuth state objects stay on-device.

Frequently Asked Questions

Why does native JavaScript btoa() fail on JSON strings containing Korean, Japanese, or emoji characters?

Native window.btoa() accepts strictly Latin1 code points (0–255) and throws DOMException on characters above U+00FF. Base64Doc runs TextEncoder UTF-8 serialization first so multi-byte scripts encode cleanly.

Can I encode JSON as unpadded URL-Safe Base64 for HTTP headers or query strings?

Yes, enable RFC 4648 §5 URL-Safe and Omit Trailing = to generate URL-safe Base64URL strings free of +, /, and =.

Does pretty-printed JSON produce a larger Base64 string than minified JSON?

Yes, every indentation space and newline in pretty-printed JSON gets encoded verbatim, typically adding 15%–35% extra Base64 characters.

Should I use Base64 JSON to hide sensitive user data inside URL query strings?

No, Base64 is reversible encoding rather than encryption; anyone can decode eyJ... tokens locally, so sign or encrypt sensitive claims with JWS/JWE or keep secrets server-side.

Are GCP or service-account JSON key files uploaded when encoded here?

No, encoding executes 100% locally in browser memory with zero network transmission.

Explore All 34 Base64 Converters & Developer Tools