Skip to content
Encoding2026-08-286 min read

How to Batch Encode Multiple Files or Texts to Base64 (No Script Needed)

You want to inline 30 images into HTML (via data:image/png;base64,…), or encode a batch of config strings into a file. Doing it one by one is slow; writing a script feels like overkill. Is there a batch way?

Yes. Here's how batch Base64 encoding works, and when to use it vs when not to.

What batch Base64 encoding is

Base64 encodes binary (images, files) or text into ASCII containing only A-Z a-z 0-9 + / =, so it can travel through text-only channels (email, JSON, URL, CSS).

"Batch" means processing many inputs at once instead of manually one by one.

When you need batch

ScenarioExample
Inline small icons in frontendConvert dozens of SVG/small PNGs to data URIs in CSS
Test data prepBatch-generate Base64 strings for API load tests
Email attachmentsConvert multiple files to MIME base64
Config filesBatch-encode keys/certs into yaml

⚠️ Size warning: Base64 inflates data by ~33%. Don't inline large images (>tens of KB)—use a CDN/image host instead, or you'll slow page loads.

Step-by-step batch (no script)

Use this site's Batch Base64 tool—runs locally, files never uploaded:

  1. Open the Batch Base64 tool.
  2. Pick mode: Text batch or File batch.
  3. Text mode: paste one string per line (or multiple blocks separated by a delimiter).
  4. File mode: drag in multiple files (images or text).
  5. Click "Encode All"—the tool outputs each result; copy or export in one click.
  6. To reverse, use the Base64 decoder.

Command line batch (developers)

# Batch: encode every png to a .b64 file
for f in *.png; do base64 "$f" > "$f.b64"; done

# macOS: single file to base64
base64 -i icon.png -o icon.b64

# Windows PowerShell
[Convert]::ToBase64String([IO.File]::ReadAllBytes("icon.png"))

Images: produce a ready data URI

For pasting directly into HTML/CSS, besides the batch tool, use:

  • Image to Base64 — single image to data URI, auto-adds data:image/png;base64, prefix.
  • Base64 to Image — turn Base64 back into a downloadable image file.

Common pitfalls

Line breaks (CRLF vs LF): Some systems add a newline every 76 chars. Strip these before decoding or it errors. This site outputs continuous, no-line-break strings, ready to use.

URL-safe Base64: Standard Base64 has + and /, which get escaped in URLs. If you need URL-safe Base64 (- and _), confirm your tool/library supports it.

Chinese mojibake: Base64 only sees bytes. If decoded text is garbled, the issue isn't Base64—it's character encoding (UTF-8 vs GBK). See Base64 Chinese mojibake.

FAQ

Q: Batch-encoding hundreds of images—will it lag? Local processing; bottleneck is browser memory and disk. Thousands of small images are fine; very large files—do in chunks.

Q: Output usable directly in JSON? Yes—Base64 has no JSON-breaking chars (except = padding, which is legal in JSON strings). Watch the ~33% size inflation.

Q: Can I batch-decode too? Yes—paste Base64 lines into the Base64 decoder, or use the batch tool's reverse mode if available.

Batch processing: where the real-world friction lives

Batch base64 is conceptually trivial; the friction is in the details. Filename handling: does the tool derive output names (photo.jpg → photo.jpg.b64 or photo.b64) and what happens on collision? Batch limits: encoding 200 files inline produces a 200-result page that freezes browsers — progressive download (one .b64 per file, zipped) is the production-grade answer. Error isolation: one corrupt input should not abort the batch at file 3 of 200 (fail-soft with a report beats fail-fast here). And memory: base64-inflated results of a 500MB folder never fit in a tab; tools that stream file-by-file with a manifest handle the sizes that matter.

The checksum companion workflow

The underrated pairing: batch-base64 for transport, checksums for verification. When moving files through channels that mangle encoding (email gateways, copy-paste into ticketing systems, "save as" from browsers), the base64 survives but the decode step needs proof of integrity. The professional pattern: generate filename.sha256 alongside each .b64, verify after decode — a 30-second step that converts "I think it transferred" into "byte-identical, confirmed". Our hash verifier closes the loop locally; files never leave the machine to prove they arrived.

When NOT to base64 at batch scale

Base64's 33% inflation compounds at batch scale: a 1GB folder becomes 1.33GB of text, slower to transfer than the binary it replaced in every modern context. Base64 earned its place when channels rejected binary (SMTP historically, some JSON APIs, XML payloads); today the correct transport for bulk binary is binary (multipart upload, object storage presigned URLs). Reserve batch-base64 for channel constraints you actually face — not as a default wrapper. The decision test: if the receiver can accept a file upload, they should.

Line-oriented text vs file-oriented batches

Two batch shapes get confused. Line-oriented paste (many secrets, tokens, or short strings, one per line) belongs in the batch Base64 tool: encode/decode keeps row alignment so you can diff before/after. File-oriented batches (folders of images) need per-file MIME prefixes if you are building Data URIs — use Image to Base64 for singles, or a local script with streaming for hundreds of megabytes. Mixing the two (pasting a multi-megabyte file as one “line”) freezes the tab; that is a shape mismatch, not a Base64 bug.

Overhead compounds across the batch

Each row still pays ~33% (see Base64 size increase). A hundred 10 KB icons become ~1.3 MB of text in HTML — often worse than one sprite sheet or HTTP/2 multiplexing. Before batch-inlining, estimate rows × avgBytes × 4/3 and decide whether caching independent URLs wins. The single-file Base64 decoder size panel is useful for sampling one representative row.

Summary

Batch Base64 encoding = convert many inputs to ASCII at once. Great for small images/configs; use external links for large files. Use this site's Batch Base64 tool locally—no script, no upload, safer for sensitive batch data.

Triage notes

Batch mode is deliberately split into per-line and whole-file forms because the two get conflated: short tokens one per line suit a batch tool, while pasting an entire large file as one "line" will freeze the tab — that is a wrong-shape problem, not Base64 breakage. The inflation warning is repeated for batch because 33% multiplies by row count: a hundred 10 KB icons inline to roughly 1.3 MB of text, hence the rows × avgBytes × 4/3 estimate and the advice to link large files instead. The mojibake entry assigns blame carefully: Base64 only moves bytes, so garbled output after decoding is a character-encoding issue (UTF-8 vs GBK), never a Base64 one.