Encoding Batch Processing 2026-04-07

Batch Base64 Encode/Decode Files

Encode or decode hundreds of files to Base64 using bash one-liners, Python scripts, and Node.js. Perfect for embedding assets, CI/CD pipelines, and data migration.

Tools used: Base64 Encoder + Image to Base64 All Free

The Problem

You have dozens (or hundreds) of files that need Base64 encoding — config files for Kubernetes secrets, images for email templates, or binary assets for JSON APIs. Encoding them one at a time in a web tool is painfully slow.

Why Batch Processing Matters

Batch Base64 encoding is essential for CI/CD pipelines (Kubernetes secrets, Docker configs), embedding images in HTML emails at scale, preparing binary data for JSON APIs, and migrating assets between systems. Automating this saves hours of manual work.

Common Use Cases

  • Encode all images in a directory for inline HTML email templates
  • Create Kubernetes secrets from multiple config files in CI/CD
  • Convert font files to Base64 data URIs for CSS embedding
  • Prepare binary attachments for JSON API payloads

Step-by-Step Instructions

1

Identify files to encode

Use find or ls to list target files. Filter by extension (*.png, *.json, *.pem) to avoid encoding the wrong files.

2

Choose your encoding method

For quick one-offs, use the Base64 Encoder web tool. For batch operations, use the CLI commands or scripts below.

3

Run the batch encode command

Pick your preferred language (Bash, Python, or Node.js) from the code examples below. Each script reads files from a directory and outputs .b64 files.

4

Verify the output

Spot-check a few encoded files by decoding them back: base64 -d file.b64 | file - should show the original file type. Compare file counts to ensure nothing was missed.

Code Examples

# Encode all PNG files in current directory
find . -name '*.png' -exec sh -c 'base64 "$1" > "$1.b64"' _ {} \;

# Encode with proper data URI prefix for HTML
for f in *.png; do
  echo "data:image/png;base64,$(base64 -w0 "$f")" > "${f%.png}.b64"
done

# Decode all .b64 files back to original
find . -name '*.b64' -exec sh -c 'base64 -d "$1" > "${1%.b64}"' _ {} \;

# Pipe from stdin (e.g., curl output)
curl -s https://example.com/image.png | base64 -w0

Single vs Batch Comparison

Single file (web tool)
Drag & drop one file → click Encode → copy output
Batch output (CLI)
$ find ./assets -name '*.png' | wc -l
47
$ find ./assets -name '*.png' -exec sh -c 'base64 "$1" > "$1.b64"' _ {} \;
$ find ./encoded -name '*.b64' | wc -l
47
# All 47 files encoded in 0.3 seconds

Download Workflow Template

Save this JSON workflow template to automate this process in your CI/CD pipeline or scripts.

Download batch-base64-encode.json

Frequently Asked Questions

How much larger are Base64-encoded files?

Base64 encoding increases file size by approximately 33%. A 1 MB file becomes ~1.33 MB encoded. For large files, consider gzip compression before encoding.

Is there a file size limit for Base64 encoding?

There's no inherent limit, but very large Base64 strings (>10 MB) can cause memory issues in browsers and some APIs. For large files, consider chunked encoding or direct binary transfer.

What's the difference between base64 and base64url encoding?

Standard Base64 uses + and / characters, while Base64url uses - and _ instead. Base64url is safe for URLs and filenames. Use base64.urlsafe_b64encode() in Python.

Related Batch Guides

Try these tools interactively

Each tool runs in your browser with no signup required. Process single items instantly.

Related Workflow Guides