# Encoding Toolkit: Base64, Hash, URL Encode, JSON to CSV (`forgeloop/encoding-toolkit`) Actor

Base64 and hex encode or decode texts and files, URL and HTML encode, MD5, SHA and HMAC hashes, CRC32, UUIDs, JSON pretty, minify and validate, JSON to CSV, CSV to JSON, JWT decode, slugs and text stats. Up to 10,000 items per run, one row each. For automations and AI agents.

- **URL**: https://apify.com/forgeloop/encoding-toolkit.md
- **Developed by:** [Markus Heiß](https://apify.com/forgeloop) (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.50 / 1,000 item processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Encoding Toolkit: Base64, Hash, URL Encode, JSON to CSV

One Actor for the small data jobs that automations and AI agents need all the time. Pick an operation, pass a list of texts or file URLs and get one clean dataset row per item: Base64 and hex encoding and decoding, URL and HTML entity encoding, MD5, SHA and HMAC hashes, CRC32, UUIDs, JSON pretty print, minify and validation, JSON to CSV and back, JWT decoding, slugs and text statistics.

Everything runs inside the Actor in plain Node.js. Your texts are not sent to any other service. Files are downloaded only from the URLs you give.

### What it does

- **Base64, Base64url, hex:** encode texts and files, decode back to text or to a file. Decoded images, PDFs and ZIPs are stored in the run's key-value store with a download URL. Data URIs (`data:image/png;base64,...`) are decoded with their content type, and Base64 encoding can return a data URI ready for HTML, CSS or an LLM image payload.
- **URL encoding:** component mode for query values, full URI mode that keeps `: / ? & = #`, and form mode with `+` for spaces. Decoding reports broken `%` sequences as an error instead of guessing.
- **HTML entities:** escape `& < > " '`, optionally every non-ASCII character as `&#...;`. Decoding handles numeric entities and the full HTML 4 named set (`&eacute;`, `&euro;`, `&hellip;`, ...).
- **Hashes and checksums:** MD5, SHA-1, SHA-256, SHA-512 and CRC32 of texts or files, as hex or base64. HMAC with SHA-256, SHA-1, SHA-512 or MD5 and a secret key in an encrypted input field, for example to compute or check webhook signatures.
- **UUID v4:** generate 1 to 10,000 random UUIDs, one row each.
- **JSON:** pretty print with your indent, minify, and validate with the line and column of the first error.
- **JSON to CSV:** arrays of objects become rows, the columns are the union of all keys, nested objects become columns like `address.city`. Comma, semicolon, tab or pipe as delimiter, correct quoting.
- **CSV to JSON:** RFC 4180 parsing with quoted fields, line breaks inside quotes and a delimiter that is detected for you. Values stay strings unless you turn on number and boolean conversion, so zip codes and IDs keep their leading zeros.
- **JWT decode:** header and payload as JSON, plus `alg`, issued, not before and expiry dates and an `expired` flag. The signature is NOT verified and every row says so.
- **Slugify:** URL slugs from titles in any Latin script (`Grüße aus Österreich` becomes `grusse-aus-osterreich`), with an optional length limit.
- **Text stats:** characters, characters without spaces, words, lines, sentences and UTF-8 bytes.
- **Safe file downloads:** only direct `http` and `https` file links, up to 25 MB. Private and local network addresses are blocked for the URL and every redirect. Links to video platforms and social media sites are refused.

### Use cases

- **Make, n8n and Zapier:** one step for Base64 attachments, signed webhook checks, CSV exports from JSON APIs or slugs for a CMS, without code modules.
- **AI agents:** give an agent a reliable tool for encoding, hashing and format conversion instead of letting the model guess Base64 or SHA-256 by itself.
- **File integrity:** compute SHA-256, MD5 or CRC32 checksums of a list of download URLs and compare them with published values.
- **Data cleanup:** validate a batch of JSON documents, convert a CSV export to JSON for an API, or turn API JSON into a CSV for a spreadsheet.
- **Debugging:** decode JWTs, URL encoded parameters and HTML entities from logs in bulk.

### Input

| Field | Description | Default |
|---|---|---|
| Operation | One of the 25 operations listed above | Base64 encode |
| Items | Texts or direct file URLs, one per entry. Over the API also `{"text": "..."}` or `{"url": "..."}` | |
| Text | One multi-line item such as a CSV table or a JSON document, processed first | |
| Input type | `auto`: single URLs are files for operations that accept files. `text`: never download. `url`: every item is a file link | `auto` |
| Number of UUIDs | For UUID v4, 1 to 10,000 | 5 |
| Secret key (HMAC) | Secret, encrypted, never in the output or the log | |
| Secret key encoding | `utf8`, `hex` or `base64` | `utf8` |
| HMAC algorithm | `sha256`, `sha1`, `sha512`, `md5` | `sha256` |
| Hash output | `hex` or `base64` | `hex` |
| Base64 as data URI | Return `data:<type>;base64,...` | off |
| Decoded output | `auto` (text or file), `text`, `file` | `auto` |
| URL encode mode | `component`, `uri`, `form` | `component` |
| HTML encode mode | `basic` or `nonAscii` | `basic` |
| JSON indent | Spaces per level for pretty print | 2 |
| CSV delimiter | `auto`, `comma`, `semicolon`, `tab`, `pipe` | `auto` |
| CSV has a header row | First row holds the field names | on |
| Convert CSV numbers and booleans | `42` becomes a number, `true` a boolean, empty cells `null` | off |
| Flatten nested JSON | Nested objects as dotted columns in JSON to CSV | on |
| Max slug length | 0 means no limit | 0 |
| Include input summary | First 200 characters of each text or the file URL in the row | on |

Example, SHA-256 checksums of two files and a text:

```json
{
  "operation": "sha256",
  "items": [
    "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
    "https://jsonplaceholder.typicode.com/users",
    "hello world"
  ]
}
```

Example, HMAC-SHA256 signature of a webhook body, with the key in the secret field:

```json
{
  "operation": "hmac",
  "items": ["{\"event\":\"order.created\",\"id\":1001}"],
  "secretKey": "YOUR_WEBHOOK_SECRET",
  "hmacAlgorithm": "sha256",
  "hashEncoding": "hex",
  "inputType": "text"
}
```

### Output

One dataset item per input item (per UUID for UUID v4):

```json
{
  "index": 1,
  "operation": "base64Decode",
  "inputType": "text",
  "input": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
  "inputBytes": 96,
  "inputContentType": null,
  "result": null,
  "resultType": "file",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/AbC123/records/decoded-00001.png?signature=3kX9pQ2LmN7vR4tY8wZa",
  "fileKey": "decoded-00001.png",
  "fileContentType": "image/png",
  "resultBytes": 70,
  "data": null,
  "warning": null,
  "error": null
}
```

- `index` is the position of the item in the input, the Text field first. Rows keep the input order.
- `inputType` is `text`, `file` or `none` (UUIDs). `input` holds the first 200 characters of a text or the file URL. Passwords in URLs and query values named like signature, token, key or secret are replaced by `***`. JWTs are always masked. The HMAC key never appears anywhere.
- `inputBytes` is the UTF-8 size of a text or the size of the downloaded file. `inputContentType` is the type the server sent for a file.
- `result` is the output as text: the encoded or decoded string, the hash, the CSV, the JSON. CSV to JSON returns the JSON array as a string, so every row has the same shape.
- `resultType` is `text` or `file`. Files (decoded binary data, and results larger than 5 MB) are stored in the run's key-value store. `fileUrl` opens the file without an Apify token (it carries a signature), `fileKey` is its key, `fileContentType` its type.
- `resultBytes` is the size of the result in bytes.
- `data` holds extra structured facts for some operations: JSON validation (`valid`, `type`, `length`, `message`), CSV and JSON conversion (`rows`, `columns`, `columnNames`, `delimiter`), JWT (`header`, `payload`, `algorithm`, `issuedAt`, `expiresAt`, `expired`), text stats, CRC32 as a decimal and the HMAC algorithm.
- `warning` explains things you should know, for example that a JWT signature was not verified.
- Items that fail (invalid Base64, broken JSON for pretty print, a file that is too large, unreachable or of the wrong type, a refused platform link) return a row with `error` set and are free. JSON validate returns `invalid` as a normal, charged result.

### Pricing

Pay per item: 0.0005 USD for every item processed, so 0.50 USD per 1,000 items. One UUID counts as one item. Items with an error are free. Set the maximum charge in Apify to cap the cost of a run; the Actor stops cleanly when it is reached.

Each run also has a start fee of 0.00005 USD per GB of memory, which Apify shows as Actor Start. The default 512 MB is enough for files up to the 25 MB limit.

### Limits

- At most 10,000 items per run. Split larger lists into several runs.
- Text items up to 5 MB each. Files up to 25 MB each, downloaded with a 60 second timeout and up to 5 redirects.
- Only direct `http` and `https` file links. No private or local network addresses. Links to YouTube, TikTok, Instagram, Vimeo and other video, streaming and social sites are refused.
- Results over 5 MB, for example the Base64 of a 20 MB file, are stored as a file in the key-value store instead of the row.
- Text operations (JSON, CSV, text stats, decoding from a file) need UTF-8 text files. Binary files return an error row.
- JWT decode does not verify signatures and cannot read encrypted tokens (JWE).
- HTML entity decoding covers numeric entities and the HTML 4 named set. Rare HTML5 names stay as they are.
- Files in the key-value store are kept as long as the run's storage, by default according to your Apify data retention.

### Data source, permitted use and legal

- **Data source:** The texts you enter and the files at the URLs you list. All operations run inside the Actor. The Actor is not affiliated with any of the sites you download files from.
- **Snapshot:** Results show the files and texts at the time of the run. We do not guarantee that they are complete, current or correct.
- **For business use:** This Actor is offered to businesses only, not to consumers.
- **Permitted use:** Process only texts and files you own or are allowed to use. Use HMAC keys and decode JWTs only for systems you are entitled to access.
- **Your responsibility:** You choose the inputs and decide what happens with the results. If your texts, files or tokens contain personal data, you are the controller and need your own legal basis. JWT payloads often contain user IDs or email addresses; turn off the input summary for confidential data.
- **No circumvention:** The Actor downloads only direct, public file links. It does not bypass logins, captchas, rate limits, paywalls or other access restrictions, it has no proxy option, and it refuses video and social media platforms.
- **Request volume:** One download per file, at most 3 at a time, with up to 3 retries and backoff on HTTP 429 and 5xx. Do not use it to put load on servers you do not own.
- **Provider:** forgeloop, Markus Heiss, Austria. [Imprint](https://devhem.github.io/forgeloop-legal/imprint.html), [Privacy Notice](https://devhem.github.io/forgeloop-legal/privacy.html), [Terms of Use](https://devhem.github.io/forgeloop-legal/terms.html).

### Questions and issues

Open an issue on the Actor page.

# Actor input Schema

## `operation` (type: `string`):

What to do with every item. Hashes, Base64 and hex work on texts and files. URL, HTML, JWT and slug operations work on text only. UUID v4 ignores the items and generates the number of UUIDs set below.

## `items` (type: `array`):

One entry per item: a text, or a direct http(s) link to a file (for Base64, hex, hashes, CRC32, JSON, CSV and text stats). Empty entries are skipped. Over the API you can also pass objects like {"text": "..."} or {"url": "https://..."} to be explicit. Use the Text field below for one multi-line text such as a CSV or a JSON document.

## `text` (type: `string`):

Optional. One text item that can span many lines, for example a CSV table, a JSON document or a long text. It is processed as the first item, before the Items list.

## `inputType` (type: `string`):

Auto downloads an item that is a single http(s) URL as a file for operations that accept files, and treats everything else as text. Text never downloads, so a URL is encoded or hashed as the string itself. File URL treats every item as a link to a file.

## `uuidCount` (type: `integer`):

Only for UUID v4: how many random UUIDs to generate, one row each.

## `secretKey` (type: `string`):

Only for HMAC: the shared secret. Stored encrypted and never written to the output or the log.

## `secretKeyEncoding` (type: `string`):

How the secret key is written. Most webhook secrets are plain text (UTF-8).

## `hmacAlgorithm` (type: `string`):

Hash function for HMAC.

## `hashEncoding` (type: `string`):

For MD5, SHA and HMAC: lowercase hex or base64.

## `dataUri` (type: `boolean`):

For Base64 encode: return data:<content type>;base64,... ready to paste into HTML, CSS or an LLM image payload. The content type comes from the server or the file bytes.

## `decodeOutput` (type: `string`):

For Base64, Base64url and hex decode. Auto returns clean UTF-8 text in the row and stores everything else (images, PDFs, ZIPs) as a file in the key-value store with a download URL. Text always returns text. File always stores a file.

## `urlEncodeMode` (type: `string`):

Component encodes every reserved character (for query values). Full URI keeps : / ? & = # intact. Form encodes spaces as + (application/x-www-form-urlencoded) and decodes + as a space.

## `htmlEncodeMode` (type: `string`):

Basic escapes & < > " and '. Non-ASCII also turns every character above ASCII into a numeric entity.

## `jsonIndent` (type: `integer`):

For JSON pretty print: spaces per level.

## `delimiter` (type: `string`):

For CSV to JSON and JSON to CSV. Auto detects the delimiter of a CSV from its first line and writes commas for JSON to CSV.

## `csvHeader` (type: `boolean`):

For CSV to JSON: use the first row as field names. Off names the fields column1, column2 and so on.

## `csvParseValues` (type: `boolean`):

For CSV to JSON: turn 42, 3.5, true and false into JSON numbers and booleans and empty cells into null. Off keeps every value as a string, which is safe for IDs and zip codes with leading zeros.

## `flattenNested` (type: `boolean`):

For JSON to CSV: nested objects become columns like address.city. Off writes nested objects as JSON text in one cell. Arrays are always written as JSON text.

## `slugMaxLength` (type: `integer`):

For Slugify: cut slugs at this many characters, at a word boundary. 0 means no limit.

## `includeInput` (type: `boolean`):

Add the first 200 characters of each text (or the file URL) to its row. JWTs are always masked and signed URL parameters are hidden. Turn off when the inputs are confidential.

## Actor input object example

```json
{
  "operation": "base64Encode",
  "items": [
    "Hello, world!",
    "forgeloop encoding toolkit"
  ],
  "inputType": "auto",
  "uuidCount": 5,
  "secretKeyEncoding": "utf8",
  "hmacAlgorithm": "sha256",
  "hashEncoding": "hex",
  "dataUri": false,
  "decodeOutput": "auto",
  "urlEncodeMode": "component",
  "htmlEncodeMode": "basic",
  "jsonIndent": 2,
  "delimiter": "auto",
  "csvHeader": true,
  "csvParseValues": false,
  "flattenNested": true,
  "slugMaxLength": 0,
  "includeInput": true
}
```

# 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 = {
    "operation": "base64Encode",
    "items": [
        "Hello, world!",
        "forgeloop encoding toolkit"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgeloop/encoding-toolkit").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 = {
    "operation": "base64Encode",
    "items": [
        "Hello, world!",
        "forgeloop encoding toolkit",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("forgeloop/encoding-toolkit").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 '{
  "operation": "base64Encode",
  "items": [
    "Hello, world!",
    "forgeloop encoding toolkit"
  ]
}' |
apify call forgeloop/encoding-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forgeloop/encoding-toolkit"
        }
    }
}
```

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/VSEQGZ9GmXj2vNgAu/builds/KrCipJdBPph6mKWU7/openapi.json
