Base64Doc

Generate RFC 2397 Base64 Data URIs

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

Drop any image, SVG, WOFF2 font, audio clip, or PDF to generate a verified data:<mime>;base64,... URI with exact magic-byte MIME detection.

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)

RFC 2397 Syntax Precision & Magic-Byte MIME Detection

Ensure every generated Data URI carries an exact IANA-registered media type verified from binary headers rather than fragile file extensions.

Read full technical details

The RFC 2397 Data URL scheme follows a strict grammar: data:[<mediatype>][;base64],<data>. When developers construct strings manually or use extension-only helpers, subtle mistakes cripple rendering—forgetting the ;base64 token, emitting image/jpg instead of image/jpeg, or assigning application/octet-stream to a WOFF2 webfont.

Base64Doc evaluates the file’s actual header octets across 66 signatures—identifying WOFF2 (77 4F 46 32 -> font/woff2), SVG (<svg -> image/svg+xml), WebP (RIFF...WEBP -> image/webp), MP3 (ID3 -> audio/mpeg), and Office OOXML manifests—so every Data URI matches browser expectations.

Inlining Fonts, Icons & Single-File HTML Fixtures Safely

Bundle small WOFF2 glyph subsets, inline icons, and audio cues into standalone HTML demos or browser extensions without external requests.

Read full technical details

Single-file printable reports, offline documentation bundles, and browser bookmarklets benefit hugely from self-contained Data URIs because assets never fail due to CORS headers or offline networks. Copying the CSS tab builds clean @font-face or background-image declarations in one step.

For multi-megabyte documents like PDFs inside iframes, remember that top-level URL parsers cap data: strings around 2 MB—making Blob URLs mandatory during decoding.

Automatic Mismatch Repair When Decoding Broken Data URIs

Switch to Decode mode at any time to audit third-party Data URIs and repair wrong mediatype headers automatically.

Read full technical details

Beyond generation, pasting an existing Data URI into Decode mode strips the header, checks underlying magic bytes, and surfaces any conflict immediately with a repaired prefix.

Step-by-Step Local Workflow

STEP 1

Drop Image, Font, Audio, PDF, or Text File

Select any local asset from disk or paste raw text/SVG markup; all bytes remain inside your browser Web Worker with zero server upload.

STEP 2

Auto-Detect Exact Media Type via Magic Bytes

Instead of trusting filename extensions blindly, Base64Doc checks 66 binary signatures (such as 77 4F 46 32 for font/woff2) to set the true MIME header.

STEP 3

Emit RFC 2397 data:<mime>;base64 Output

Generate a clean single-line Data URI free of embedded newlines, quotes, or whitespace that break CSS url(...) and HTML src attributes.

STEP 4

Copy Raw Data URI or Wrapper Snippet

Grab the bare Data URI string or switch to CSS, HTML, Markdown, or JavaScript tabs ready to drop into self-contained web builds.

Technical Specification Summary

CapabilityBase64Doc BehaviorEngineering Notes
RFC 2397 Syntaxdata:[<mediatype>][;base64],<data>Empty mediatype defaults to text/plain;charset=US-ASCII per spec.
Detected Asset ClassesImages, WOFF/WOFF2, PDF, Audio, SVG66 signatures plus OOXML XML classification verify the exact MIME type.
Browser Navigation Cap~2 MB in top-level/iframe URLsCSS @font-face and <img> handle larger URIs better than <iframe> PDFs.
Line Break PolicySingle-line (MIME-76 off)RFC 2397 URLs inside CSS/HTML should omit CRLF line wrapping.
Overhead FormulaPrefix (22–85 B) + ceil(N/3)*4Live readout displays exact final character count and byte footprint.

Frequently Asked Questions

How is a Data URI different from a raw Base64 string?

A Data URI prepends data:<mime-type>;base64, ahead of raw Base64 characters so browsers and CSS engines know whether to decode an image, font, audio clip, or PDF.

Can Base64Doc repair a Data URI that has the wrong MIME type in its header?

Yes, pasting a mismatched Data URI into Decode mode inspects the underlying magic bytes and constructs the corrected data:<real-mime>;base64, header automatically.

Are WOFF2 and TTF webfont Data URIs supported on this generator?

Yes, dropping .woff2 (77 4F 46 32) or .ttf (00 01 00 00) fonts detects font/woff2 or font/ttf accurately for @font-face src: url(...) CSS rules.

Should a Data URI include 76-character MIME line breaks?

No, omit 76-character line wrapping for RFC 2397 Data URIs embedded in HTML or CSS attributes; extra newlines can break URL parsers.

What happens if I omit the media type inside a Data URI like data:;base64,...?

Per RFC 2397, omitting the media type defaults to text/plain;charset=US-ASCII, causing browsers to refuse rendering binary images or fonts.

Explore All 34 Base64 Converters & Developer Tools