Base64Doc

Validate Base64 & Pinpoint Invalid Characters

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

Stop guessing why base64: invalid input happens: pinpoint the exact 1-based line, column, and Unicode code point of bad characters, or auto-clean dirty strings.

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
Decoded Result & Document Actions Appear Here

Paste any Base64 string, Data URI, Postman JSON, SOAP XML, HAR, or EML payload on the left.

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)

Exact Line, Column & Unicode Diagnostics vs Vague "Invalid Input"

Find the exact offending character inside a 50,000-character Base64 block instead of staring at blind "invalid input" errors.

Read full technical details

Terminal tools and naive web decoders fail silently or emit unhelpful one-liners like "base64: invalid input" without telling you where the problem sits inside a multi-kilobyte log block. Invisible copy-paste artifacts—like zero-width spaces (U+200B), curly smart quotes from chat apps, or a stray hyphen inside a standard string—look identical to valid characters on screen.

Base64Doc scans characters deterministically and reports the exact 1-based line number, column number, character offset, and Unicode code point (U+XXXX) on the very first violation.

Why Safe Wrapper Cleaning Beats Blind Regex Stripping

Strip known Data URI headers, JSON escapes, and whitespace transparently while refusing to mask real data truncation.

Read full technical details

Permissive utilities that silently delete every non-[A-Za-z0-9+/=] character destroy binary payloads whenever real data was corrupted or truncated: deleting two stray UTF-8 letters shifts every downstream 6-bit boundary and turns the rest of a PDF into garbage.

Base64Doc restricts auto-cleaning strictly to known transport wrappers (data:*;base64, headers, matching outer quotes, JSON \/ slashes, whitespace, and missing trailing = padding), listing every repair step applied. Any remaining invalid character or len % 4 === 1 truncation stops decoding fast.

Catching Concatenated Multi-Chunk Padding Bugs

Detect illegal = padding buried in the middle of a stream caused by naively joining independently encoded chunks.

Read full technical details

Concatenating independently Base64-encoded 64 KB chunks injects = or == mid-stream because 65,536 is not divisible by 3. The validator flags non-terminal = signs immediately so chunk-alignment bugs surface right away.

Step-by-Step Local Workflow

STEP 1

Paste Broken or Suspect Base64 String

Insert any string throwing base64: invalid input, atob DOMException, or Python binascii.Error directly into the validator.

STEP 2

Inspect Sanitizer Report & Wrapper Stripping

See transparently whether outer quotes, data:*;base64, headers, JSON \/ slashes, whitespace, or missing = padding caused the failure.

STEP 3

Locate Exact Line, Column & Unicode Code Point

If illegal characters remain—such as invisible U+200B zero-width spaces, smart quotes, or mid-string = signs—Fail-Fast validation pinpoints the exact 1-based coordinate.

STEP 4

Verify Decoded Payload & Download Safely

Once clean, confirm the real magic-byte file type or decoded text immediately and copy the sanitized Base64 string.

Technical Specification Summary

CapabilityBase64Doc BehaviorEngineering Notes
Error Coordinate PrecisionLine, Column, Offset, U+XXXXCatches invisible zero-width spaces (U+200B) and curly quotes instantly.
Modulo-4 Truncation Rulelen % 4 === 1 -> Impossible Base64No amount of = padding can rescue 1 leftover 6-bit character.
Safe Sanitizer ScopeData URI, quotes, \/, whitespace, =Never deletes arbitrary mid-stream letters that would corrupt binary offsets.
Mid-Stream Padding AuditRejects "=" before final 2 charsCatches accidentally concatenated multi-chunk Base64 strings.
Post-Validation Check66 Magic Bytes + Charset SniffConfirms decoded bytes actually form a valid file or legible text.

Frequently Asked Questions

Why do Linux base64 -d or Python b64decode throw invalid input errors on strings that look fine?

Common culprits include invisible zero-width spaces, JSON-escaped \/ slashes, data:*;base64, prefixes, unpadded URL-safe -/_ characters, or missing trailing = padding.

Does the validator tell me the exact position of a broken character?

Yes, it scans every character and reports the exact 1-based line, column, zero-based offset, and Unicode code point (e.g. U+200B) on the first failure.

Why does a cleaned length of 4n + 1 fail validation even after adding = padding?

Mathematically, 1 Base64 character holds only 6 bits—not enough to reconstruct 1 whole 8-bit byte—so len % 4 === 1 proves real truncation or an extra stray symbol.

Is a Base64 string still valid if = appears in the middle of the payload?

No, RFC 4648 allows = padding strictly in the final one or two positions of the entire encoded stream; mid-stream = indicates concatenated chunks or spliced logs.

Does passing syntax validation guarantee the decoded file is not corrupted?

No, valid Base64 syntax can still hold a truncated PDF or HTML 500 error page; Base64Doc follows syntax validation with 66 magic-byte checks to confirm file integrity.

Explore All 34 Base64 Converters & Developer Tools