Base64 Encoder & Decoder — Text, Files & Data URIs avatar

Base64 Encoder & Decoder — Text, Files & Data URIs

Pricing

Pay per event

Go to Apify Store
Base64 Encoder & Decoder — Text, Files & Data URIs

Base64 Encoder & Decoder — Text, Files & Data URIs

Encode text or remote files to Base64 (with ready-to-use data: URIs), or decode Base64 back to text and downloadable files. Batch input, URL-safe variant, strict validation. From $0.0002 per item; failed items never charged.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Anthony Snider

Anthony Snider

Maintained by Community

Actor stats

0

Bookmarked

8

Total users

7

Monthly active users

3 days ago

Last modified

Share

Convert text or remote files to Base64 — including a ready-to-paste data: URI — or decode Base64 back to text or a downloadable file. Built for pipelines: batch input, strict validation, URL-safe (base64url) support, and per-item billing where failed items are never charged.

What it does

Encode mode

  • Encodes any text to Base64 (standard or URL-safe RFC 4648 §5 alphabet).
  • Downloads any public file URL and returns its Base64 plus a complete data:<mime>;base64,... URI you can drop straight into an <img src>, a CSS url(), a JSON payload, or an email.
  • Large results (over ~3 MB of Base64) are stored in the run's key-value store and the dataset row carries a direct download URL instead, so dataset limits never truncate your data.

Decode mode

  • Accepts standard Base64, base64url, whitespace-littered Base64, and full data: URIs — all normalized automatically.
  • Valid UTF-8 payloads come back as plain text in the dataset.
  • Binary payloads (or any payload when Store decoded file is on) are written to the key-value store with the content type detected from magic bytes (PNG, JPEG, GIF, WebP, PDF, ZIP, XML…), and the row gives you a direct download URL.
  • Input that is not valid Base64 is reported as an error row — recorded, never charged. The actor validates before decoding; it will not hand you silently-corrupted output the way a plain Buffer.from(s, 'base64') would.

Input

FieldTypeDefaultNotes
modeencode | decodeencode
textstringsample textOne text to encode, or a Base64 string / data URI to decode
itemsstring[][]Batch — one dataset row per item
fileUrlsstring[][]Encode mode: public files to download & encode
urlSafebooleanfalseOutput base64url (-/_, no padding). Decode accepts both alphabets always
decodeToFilebooleanfalseDecode mode: always store the decoded bytes as a downloadable file
maxFileSizeMbinteger25Skip downloads larger than this (recorded, unbilled)

Example output (encode, file URL)

{
"mode": "encode",
"url": "https://example.com/logo.png",
"contentType": "image/png",
"inputBytes": 4123,
"base64": "iVBORw0KGgoAAAANSUhEUg...",
"dataUri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
"alphabet": "standard",
"processedAt": "2026-08-03T19:20:00.000Z"
}

Run it from the API

curl -X POST "https://api.apify.com/v2/acts/<username>~base64-encoder-decoder/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"mode":"encode","fileUrls":["https://example.com/logo.png"]}'

Pricing

Pay per event: a fraction of a cent per text item and per file. Anything that fails — bad Base64, dead URLs, oversized downloads — is recorded in the dataset but never billed. Data is written before the charge, so even a run that hits your spending limit keeps everything it produced.

Honest limits

  • File downloads are capped at maxFileSizeMb (max 100 MB) and 60 s per file.
  • Content-type detection covers common formats by magic bytes; unknown binaries are stored as application/octet-stream — the bytes are always exact, only the label can be generic.
  • This actor fetches only the public URLs you explicitly supply — no crawling, no login-walled content.

FAQ

How do I convert an image URL to a Base64 data URI? Encode mode with the URL in fileUrls — the result includes the raw Base64 and a complete data:<mime>;base64,... URI ready for an <img src>, CSS url(), JSON payload, or email.

How do I decode a Base64 string back to a file? Decode mode — UTF-8 payloads come back as plain text; binary payloads are stored with the content type detected from magic bytes (PNG, JPEG, PDF, ZIP, ...) and the row carries a direct download URL.

What's URL-safe Base64 and when do I need it? The RFC 4648 §5 alphabet (-/_ instead of +//, no padding) — required in URLs, JWTs, and filenames. Set urlSafe for encoding; decoding accepts both alphabets automatically.

What happens with invalid Base64 input? It's validated before decoding and reported as an error row — recorded, never charged, and never the silently corrupted bytes a plain Buffer.from(s, 'base64') would hand you.

Is there a size limit for files? maxFileSizeMb caps downloads (default 25 MB, max 100 MB, 60 s each); oversized results over ~3 MB of Base64 are stored in the key-value store with a download URL so dataset limits never truncate your data.