# Base64 Encoder & Decoder: Bulk Text, Files, Images & Data URIs (`datadesk-io/base64-encoder-decoder`) Actor

Encode or decode Base64 in bulk: texts, Base64 strings, data URIs and files by URL (images, PDFs). Auto-detects direction, URL-safe alphabet, data URI output, decoded binaries saved as downloadable files. For Make, Zapier, n8n and AI agents. $1 per 1,000 items.

- **URL**: https://apify.com/datadesk-io/base64-encoder-decoder.md
- **Developed by:** [DataDesk](https://apify.com/datadesk-io) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Base64 Encoder & Decoder: Bulk Text, Files, Images & Data URIs

Encode or decode **Base64 in bulk**: **plain text, Base64 strings, data URIs and files by URL** (images, PDFs, any file). **Auto-detects** whether each item should be encoded or decoded, supports the **URL-safe alphabet** (base64url) and **data URI output** for HTML/CSS, and saves **decoded images, PDFs and other binaries as downloadable files**. Every row includes size, MIME type and SHA-256. Built for **Make, Zapier, n8n, the API and AI agents (MCP)**. **$1 per 1,000 items.**

### Try it now (one click)

1. Click **Start**. The prefilled input encodes one text and decodes one Base64 string. In our latest check (Nov 22, 2026) it returned **3 items in about 1 seconds**. An empty input runs a small demo too.
2. Paste texts or Base64 strings (one per line) and/or file URLs, then pick a mode (auto, encode, decode).
3. Download the results as CSV, Excel or JSON, or get them via API, webhooks, Make or Zapier.

**Price example:** 100 items = **$0.105**, 1,000 items = **$1.005** ($1.00 per 1,000 items + $0.005 per run). Silver and Gold plan users pay 10% and 20% less per item. Apify's free plan includes $5 of usage every month, enough for about 4,995 items. Runs that find nothing are not charged.

#### Sample of real results

*Real rows from a local test run on Nov 22, 2026 (some columns). Each item also includes the other fields listed below.*

| Operation | Input | Output | MIME type | OK |
|---|---|---|---|---|
| encode | Hello from Apify! | SGVsbG8gZnJvbSBBcGlmeSE= | text/plain | True |
| decode | SGVsbG8gZnJvbSBBcGlmeSE= | Hello from Apify! | text/plain | True |
| encode | https://example.com/?q=base64 & more | aHR0cHM6Ly9leGFtcGxlLmNvbS8/cT1iYXNlNjQgJiBtb3… | text/plain | True |
| decode | iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAA… | — | image/png | True |

### What you get

| Field group | Fields |
|---|---|
| Conversion | operation (encode/decode), input (first 300 chars), output, sizes, URL-safe flag |
| Files | MIME type, binary flag, key-value store key and download link for decoded or large files, SHA-256 |
| Status | success flag (only successful items are charged), error message |

### Why this Actor

- **Auto mode**: mixed lists of text and Base64 are handled item by item.
- **Files and images**: encode any file by URL, decode Base64 images and PDFs back to downloadable files.
- **Data URIs** in and out (data:image/png;base64,...).
- **Failed items are free** and explained (e.g. invalid Base64).
- **$1 per 1,000 items**, below the $1.50 per 1,000 texts and $3 per 1,000 files of the most-used Base64 Actor.

### How to use it

1. Click **Try for free** (or **Start**): the prefilled input runs a quick test.
2. Paste texts or Base64 strings (one per line) and/or file URLs, then pick a mode (auto, encode, decode).
3. Click **Start** and wait a few seconds.
4. Open the **Output** tab and export as **JSON, CSV, Excel, XML or HTML**, or read the dataset via API.

### Input examples

**Encode and decode (prefill):**

```json
{"texts": ["Hello from Apify!", "SGVsbG8gZnJvbSBBcGlmeSE="]}
```

**Image URL to data URI:**

```json
{"fileUrls": ["https://apify.com/favicon.ico"], "outputDataUri": true}
```

**Decode a Base64 PNG to a file:**

```json
{"texts": ["iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="], "mode": "decode"}
```

**URL-safe tokens:**

```json
{"texts": ["user:42|role=admin"], "mode": "encode", "urlSafe": true}
```

#### Input fields

| Field | Type | Description |
|---|---|---|
| `texts` | array | One item per line: plain text to encode, or Base64 / data URI to decode. Empty = 3-item demo. |
| `mode` | string | Auto decodes items that look like Base64 or data URIs and encodes the rest. |
| `fileUrls` | array | Images, PDFs or any file by URL: each file is downloaded and returned as Base64 (or a data URI). |
| `urlSafe` | boolean | Use - and \_ instead of + and / (RFC 4648 base64url). Decoding detects it automatically. |
| `outputDataUri` | boolean | Prefix encoded output with data:<mime>;base64, (ready for HTML/CSS img src). |
| `saveDecodedFiles` | boolean | Decoded images, PDFs and other binary data are saved to the key-value store with a download link. |
| `maxFileSizeMb` | integer | Larger files are skipped (not charged). |

### Output example

*Example record from a local test run (long lists shortened).*

```json
{
  "index": 0,
  "inputType": "text",
  "input": "Hello from Apify!",
  "inputLength": 17,
  "operation": "encode",
  "urlSafe": false,
  "output": "SGVsbG8gZnJvbSBBcGlmeSE=",
  "outputLength": 24,
  "outputMimeType": "text/plain",
  "isBinary": false,
  "fileKey": null,
  "fileUrl": null,
  "sha256": "ac9e37cc326682c5bfc5dde74b5da8f9035e15ee064a3923803a643c63e8b34f",
  "success": true,
  "error": null,
  "scrapedAt": "2026-11-22T23:16:49.637517+00:00"
}
```

#### Output fields

| Field | Description |
|---|---|
| `index` | Position in the input |
| `inputType` | text or fileUrl |
| `input` | Input text (first 300 chars) or file URL |
| `inputLength` | Characters (text) or bytes (file) |
| `operation` | encode or decode |
| `urlSafe` | True when the base64url alphabet was used |
| `output` | Encoded Base64 or decoded text (large outputs are in fileUrl) |
| `outputLength` | Characters of Base64 or bytes decoded |
| `outputMimeType` | Detected or declared content type |
| `isBinary` | True when the decoded data is not UTF-8 text |
| `fileKey` | Key-value store key of the saved file |
| `fileUrl` | Download link of the saved file |
| `sha256` | Hash of the raw bytes |
| `success` | True when converted (only successful items are charged) |
| `error` | Why the item failed, e.g. invalid Base64 |
| `scrapedAt` | When the row was saved (UTC) |

### Pricing

Pay-per-event: **$0.005** once per run that saves results + **$0.001 per item** ($1.00 / 1,000). Runs that save nothing are not charged.

| Items saved | Approx. cost |
|---|---|
| 20 | $0.025 |
| 100 | $0.105 |
| 1,000 | $1.005 |
| 10,000 | $10.005 |

### Use cases

- Prepare images and PDFs as Base64 for APIs (OpenAI, email, CRMs) in Make, Zapier or n8n
- Decode Base64 attachments and webhook payloads back to files
- Generate data URIs for HTML emails and CSS
- Encode credentials and tokens (base64url) in automations
- Give AI agents a reliable Base64 tool through MCP

### Integrations / API

Works with the Apify API, Schedules, webhooks, Make, Zapier, n8n and MCP. Example:

```bash
curl "https://api.apify.com/v2/acts/datadesk-io~base64-encoder-decoder/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"texts": ["Hello from Apify!", "SGVsbG8gZnJvbSBBcGlmeSE="]}'
```

Python:

```python
from apify_client import ApifyClient
client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("datadesk-io/base64-encoder-decoder").call(run_input={"texts": ["Hello from Apify!", "SGVsbG8gZnJvbSBBcGlmeSE="]})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### MCP

Use this Actor from an MCP client (Cursor, Claude Desktop, etc.) through the Apify MCP server (`datadesk-io/base64-encoder-decoder`).

### FAQ

**How does auto mode decide?** Items that are valid Base64 (or data URIs) and decode to readable text or a known file type are decoded; everything else is encoded. Use Encode or Decode mode to force one direction.

**Where do decoded files go?** Binary results (images, PDFs...) and very large outputs are saved in the run key-value store; the row has a download link.

**Is my data sent anywhere?** No. Conversion runs inside the Actor; only file URLs you give are downloaded.

**What is the size limit?** Files up to 50 MB (default 10 MB). Outputs above 200,000 characters are stored as files.

### Limitations

- Files by URL up to 50 MB.
- Text input is treated as UTF-8.
- Very large outputs are delivered as a file link instead of inline.

### Start now

Click **Start** to run the prefilled example, then adjust the input. Missing a field or filter? Open an issue on the **Issues** tab and tell us what you need.

### Support

Questions, bugs or a missing field? Email **datadesk.io@proton.me** or open an issue on the Actor page.

***

**ES:** Codifica o decodifica Base64 en lote: textos, cadenas Base64, data URIs y archivos por URL (imágenes, PDF). Detección automática, alfabeto URL-safe, salida data URI y archivos decodificados descargables. $1 por 1.000 elementos.
**PT:** Codifique ou decodifique Base64 em lote: textos, strings Base64, data URIs e arquivos por URL (imagens, PDF). Detecção automática, alfabeto URL-safe, saída data URI e arquivos decodificados para download. US$1 por 1.000 itens.

# Actor input Schema

## `texts` (type: `array`):

One item per line: plain text to encode, or Base64 / data URI to decode. Empty = 3-item demo.

## `mode` (type: `string`):

Auto decodes items that look like Base64 or data URIs and encodes the rest.

## `fileUrls` (type: `array`):

Images, PDFs or any file by URL: each file is downloaded and returned as Base64 (or a data URI).

## `urlSafe` (type: `boolean`):

Use - and \_ instead of + and / (RFC 4648 base64url). Decoding detects it automatically.

## `outputDataUri` (type: `boolean`):

Prefix encoded output with data:<mime>;base64, (ready for HTML/CSS img src).

## `saveDecodedFiles` (type: `boolean`):

Decoded images, PDFs and other binary data are saved to the key-value store with a download link.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped (not charged).

## Actor input object example

```json
{
  "texts": [
    "Hello world",
    "SGVsbG8gd29ybGQ="
  ],
  "mode": "auto",
  "fileUrls": [
    "https://apify.com/favicon.ico"
  ],
  "urlSafe": false,
  "outputDataUri": false,
  "saveDecodedFiles": true,
  "maxFileSizeMb": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "texts": [
        "Hello from Apify!",
        "SGVsbG8gZnJvbSBBcGlmeSE="
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datadesk-io/base64-encoder-decoder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "texts": [
        "Hello from Apify!",
        "SGVsbG8gZnJvbSBBcGlmeSE=",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("datadesk-io/base64-encoder-decoder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "texts": [
    "Hello from Apify!",
    "SGVsbG8gZnJvbSBBcGlmeSE="
  ]
}' |
apify call datadesk-io/base64-encoder-decoder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datadesk-io/base64-encoder-decoder"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pdU3h35JvjoDo3xLC/builds/nqYGvisx1JF3R5k47/openapi.json
