Skip to content
Encoding2026-08-283 min read

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

| Scenario | Example | |---|---| | Inline small icons in frontend | Convert dozens of SVG/small PNGs to data URIs in CSS | | Test data prep | Batch-generate Base64 strings for API load tests | | Email attachments | Convert multiple files to MIME base64 | | Config files | Batch-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.

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.


Advertisement