Base64 Encode/Decode (Binary)

100% client-side processing (no server upload). Encode binary files/bytes to Base64 with format presets (RFC 4648, Base64url, MIME wrapping), padding control, strict validation, and batch multi-file support. Also supports decoding Base64 back to a downloadable file.

Loading…

About Base64 Encode/Decode (Binary)

This tool is primarily for encoding binary files (bytes) into Base64 text for transport (JSON, logs, email, configs). It also includes a decode action when you need to turn Base64 back into a downloadable binary file. Everything runs locally in your browser (no upload), with clear options for Base64 vs Base64url vs MIME wrapping, padding behavior, and strict validation.

Features

  • Upload or drag-and-drop binary files (multi-file batch supported)
  • Two actions: encode file β†’ Base64, or decode Base64 β†’ file download
  • Format presets: RFC 4648 (standard), RFC 4648 URL-safe (Base64url), RFC 2045 MIME (wrap 76 + CRLF)
  • Padding control: Auto, Always include "=", or Omit padding
  • Optional line wrapping length for encoded output (0 disables; MIME commonly uses 76)
  • Strict validation mode to reject invalid characters/padding (useful for debugging)
  • Optional final newline on Base64 output (encode mode)
  • 100% client-side processing (no server upload).

How to use for base64-binary-encoder

1

Drop one or more files (or paste Base64 for decoding)

For encoding, drag-and-drop your binary file(s) into the upload area. For decoding, paste the Base64 string you received (for example from JSON, a log, or an email).

2

Choose the action/mode and run it

Select "Action": "Encode file β†’ Base64" or "Decode Base64 β†’ file", then click the matching Run button (Encode/Decode). If needed, pick a "Format" preset (standard/Base64url/MIME), adjust padding and wrapping, and enable "Strict validation" when debugging malformed Base64.

3

Copy the Base64 output or download the decoded file

After encoding, copy the Base64 text (optionally wrapped/newline-terminated based on your settings). After decoding, download the reconstructed binary file (file naming follows the tool's rules when possible).

Technical specifications

Execution Model

Runtime disclosure, constraints, and what happens to your data.

AspectDetail
Mode100% client-side processing (no server upload).
Action scopeEncode binary β†’ Base64 (primary), plus Decode Base64 β†’ binary download
InputsEncode: File/Blob/Uint8Array/ArrayBuffer/TypedArray. Decode: Base64 string
OutputsEncode: Base64 text. Decode: bytes as a downloadable file
Limits~1–2MB chars; ~25000 ms timeout
RetentionAll processing happens locally in your browser (no upload)
For highly sensitive data (secrets, keys, regulated files), prefer offline/local tooling and avoid copying secrets into any web page.

Mini Example

A tiny byte sequence encoded to Base64 (standard RFC 4648).

ItemValue
Input bytes (hex)00 01 02 03 04 05 06 07 08 09
Output Base64AAECAwQFBgcICQ==
When output differsBase64url changes "+"/"/" to "-"/"_"; padding may be omitted; MIME may wrap lines
Encoding is deterministic: same bytes + same options β†’ same Base64 output.

Errors & Edge Cases

Common failure modes and what to do next.

SymptomLikely causeWhat to check
Input must be a string for decodeYou tried to decode but provided bytes/file instead of Base64 textSet Action to "Encode" for files; for Decode, paste a Base64 string
This tool encodes binary data... not a text stringYou tried to encode by pasting text into the binary encoderUpload a file (or provide bytes) for Encode; use the text Base64 tool for pure text workflows
Invalid characters / strict validation failureBase64 contains characters not allowed by the selected format, or bad paddingConfirm the "Format" (standard vs Base64url vs MIME) and "Padding"; disable Strict to accept lenient input
Length/padding errors (especially when Strict is on)Truncated Base64, wrong "=" padding, or mixed alphabetsRe-copy the full payload; ensure you didn't lose trailing "=", or set Padding to "Auto"
Input too large (max 2MB)Payload exceeds the tool's safety limitSplit the file/payload or use a local CLI/script for larger data
Adapter call timed outProcessing exceeded the ~25s timeout (size/device dependent)Try smaller inputs, disable Live preview, or switch to local command-line tooling

Command line alternatives

For large files, secrets, or CI usage, run Base64 encode/decode locally. Below are canonical, widely available options.

Linux/macOS (coreutils)

Encode a file to Base64 (no wrap)

base64 -w 0 input.bin > output.b64.txt

Encodes input.bin to Base64. The -w 0 flag disables line wrapping (GNU coreutils).

Encode a file to MIME-style Base64 wrapping (76 chars/line)

base64 -w 76 input.bin > output.mime.b64.txt

Matches the common MIME line length. (Line endings may differ from CRLF depending on platform.)

Decode Base64 back to a file

base64 -d input.b64.txt > output.bin

Decodes Base64 text into raw bytes.

macOS (BSD base64) / Unix

Encode a file to Base64

base64 < input.bin > output.b64.txt

BSD base64 uses different flags than GNU; this form works broadly.

Decode Base64 back to a file

base64 -D < input.b64.txt > output.bin

On macOS/BSD, decode is commonly -D (not -d).

OpenSSL (portable)

Encode a file to Base64 (single line)

openssl base64 -A -in input.bin -out output.b64.txt

The -A flag emits a single line (no wrapping).

Decode Base64 back to bytes

openssl base64 -d -in input.b64.txt -out output.bin

Useful when coreutils base64 isn't available.

Node.js

Encode a file to Base64

node -e "const fs=require('fs'); const b=fs.readFileSync('input.bin'); process.stdout.write(b.toString('base64'))" > output.b64.txt

Reads bytes and prints Base64.

Decode Base64 to a file

node -e "const fs=require('fs'); const s=fs.readFileSync('input.b64.txt','utf8').trim(); fs.writeFileSync('output.bin', Buffer.from(s,'base64'))"

Decodes Base64 text to raw bytes.

Python

Encode a file to Base64

python -c "import base64,sys; sys.stdout.write(base64.b64encode(open('input.bin','rb').read()).decode('ascii'))" > output.b64.txt

Encodes file bytes to Base64 ASCII.

Decode Base64 back to a file

python -c "import base64; open('output.bin','wb').write(base64.b64decode(open('input.b64.txt','rb').read()))"

Decodes Base64 to raw bytes.

Use cases

Embed binary data into text channels

  • Attach small binaries inside JSON payloads
  • Paste a file into issue trackers or docs as Base64
  • Transport bytes through systems that only accept text

Debug Base64 produced by another system

  • Switch between standard/Base64url/MIME presets to match the producer
  • Enable Strict validation to catch padding/alphabet mistakes
  • Use decode to confirm the payload reconstructs the original file

Pipeline checks in CI for small artifacts

  • Verify an artifact decodes without errors before publishing
  • Normalize Base64 output (wrapping/padding) for stable diffs

Safer sharing of non-secret binary snippets

  • Share reproducible test fixtures without emailing raw binaries
  • Keep secrets out of the browser tool; use local CLI for keys/tokens

❓ Frequently Asked Questions

Is there a public API for this tool?

No. This page is an in-browser tool and does not expose a public API endpoint.

Is processing local or remote?

100% client-side processing (no server upload). The file/Base64 data is processed locally in your browser.

Can I safely encode secrets (keys, tokens, passwords) here?

Avoid it. Even though processing is local, secrets can leak via clipboard history, screenshots, extensions, or shared devices. For secrets, use local command-line tools instead.

Why does decoding fail with "invalid characters" or "bad padding"?

Most decode failures come from mismatched format (standard vs Base64url vs MIME-wrapped), truncated input, or incorrect padding. Try selecting the correct "Format" preset, set Padding to "Auto", and temporarily disable "Strict validation" to see if the input is only slightly non-conformant.

Why can't I encode by pasting text directly?

This is the binary (file/bytes) variant. Encode expects bytes (File/Blob/Uint8Array/ArrayBuffer). If your input is plain text, use a text Base64 encoder so the text-to-bytes encoding is explicit.

Pro Tips

Best Practice

If you need URL-safe tokens, choose the Base64url preset; it replaces "+"/"/" with "-"/"_" and often omits padding depending on your settings.

Security Tip

When debugging a failing decode, enable Strict validation to get earlier, clearer failures, then relax it once you've identified the producer's quirks.

CI Tip

For stable diffs in CI, standardize wrapping and final newline so your Base64 outputs don't change between environments.

Security Tip

For large files or anything sensitive, prefer local CLI tooling; it avoids browser limits and reduces accidental leakage through clipboard or extensions.

Additional Resources

Other Tools