# Data Converter: Base64, Hash, CSV, JSON, XLSX \[USD 0.2/1K] (`usefulapi/data-converter`) Actor

Bulk Base64, hex, data URI, hash (MD5, SHA, CRC32), HMAC, URL and HTML encode and decode for texts and files, and CSV, TSV, JSON, JSONL, XLSX, XML, YAML conversion. USD 0.20 per 1,000 texts, USD 0.80 per 1,000 files (first MB included), USD 0.15 per 1,000 extra MB.

- **URL**: https://apify.com/usefulapi/data-converter.md
- **Developed by:** [Useful API](https://apify.com/usefulapi) (community)
- **Categories:** Developer tools, Automation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 text 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

## Data Converter: Base64, Hash, CSV, JSON, XLSX \[USD 0.2/1K]

Bulk Base64, Base64URL, hex and data URI encode and decode, hashes (MD5, SHA-1, SHA-256, SHA-512, SHA3-256, CRC32), HMAC, URL and HTML entity encode and decode, and CSV, TSV, JSON, JSONL, XLSX, XML and YAML conversion, for texts and for files. One row per item. USD 0.20 per 1,000 texts, USD 0.80 per 1,000 files (first MB included), USD 0.15 per 1,000 extra MB.

### What it does

| Operation | Text item | File item |
|---|---|---|
| `base64-encode`, `base64url-encode`, `hex-encode`, `data-uri-encode` | text in, text out | file in, text out (in the row, or a saved file when large) |
| `base64-decode`, `base64url-decode`, `hex-decode`, `data-uri-decode` | text out if the result is valid UTF-8 text, else a saved file with a detected type (png, pdf, zip ...) | same |
| `hash` (md5, sha1, sha256, sha512, sha3-256, crc32; several at once) | digests in the row | digests in the row (streamed, any size up to the limit) |
| `hmac` (md5, sha1, sha256, sha512, sha3-256; key in the input) | digest in the row | digest in the row |
| `url-encode`, `url-decode` (component, full, or form mode), `html-encode`, `html-decode` | text out | text file out (files up to 10 MB) |
| `convert` between csv, tsv, json, jsonl, xlsx, xml, yaml | text out (not xlsx) | file out, or text in the row when small |

Files come from addresses you give (`fileUrls`) and are fetched exactly as given. Results that are files (binary decodes, XLSX, large results) go to a store of their own, separate from your input, with a signed download link per file and one signed ZIP link of all of them (in the run summary `OUTPUT`; the ZIP link expires after 7 days). Links download the file (they never open it as a page). The store is unnamed, so Apify removes it after your plan's data retention period (7 days on the Free plan): copy the files before then.

### Input example

```json
{
  "operation": "hash",
  "algorithms": ["sha256", "crc32"],
  "texts": ["abc", "123456789"],
  "items": [
    { "url": "https://people.sc.fsu.edu/~jburkardt/data/csv/airtravel.csv", "operation": "convert", "targetFormat": "json" },
    { "text": "Zm9vYmFy", "operation": "base64-decode" }
  ]
}
```

`texts` and `fileUrls` use the global `operation`. `items` lets each item carry its own `operation`, `targetFormat`, `sourceFormat`, `algorithms`, `name`, `mimeType`, `sheets` or `recordPath`. For `hmac` put the key in `hmacKey` (stored encrypted by Apify; it never appears in results, the summary or the log).

### Output example (real rows from a platform run, trimmed)

```json
{ "index": 0, "kind": "file", "operation": "convert", "input": "https://people.sc.fsu.edu/~jburkardt/data/csv/airtravel.csv",
  "inputBytes": 321, "sourceFormat": "csv", "targetFormat": "json", "records": 12, "delimiter": ",", "resultBytes": 951,
  "result": "[\n  {\n    \"Month\": \"JAN\",\n    \"1958\": 340, ...", "status": "ok", "billedAs": "file-item" }

{ "index": 1, "kind": "file", "operation": "convert", "input": "https://raw.githubusercontent.com/datasets/population/main/data/population.csv",
  "inputBytes": 556718, "sourceFormat": "csv", "targetFormat": "xlsx", "records": 17394, "resultBytes": 1164514,
  "file": { "name": "population.xlsx", "key": "file-2-1-population.xlsx", "url": "https://api.apify.com/v2/key-value-stores/.../records/file-2-1-population.xlsx?attachment=true&signature=...", "bytes": 1164514 },
  "status": "ok", "billedAs": "file-item + 1 extra MB" }

{ "index": 19, "kind": "file", "operation": "hmac", "input": "https://people.sc.fsu.edu/~jburkardt/data/csv/airtravel.csv",
  "hmac": "c007b529c00a94f828847b21c4a0c7c7d472e03cc96660d5a7739481cd3334ef", "hmacAlgorithm": "sha256", "status": "ok", "billedAs": "file-item" }
```

Statuses: `ok`, `invalid_input`, `too_large`, `unsupported_format`, `not_found`, `blocked`, `private_address`, `blocked_port`, `tls_error`, `timeout`, `error`. A bad item never fails the run.

### Pricing

| Event | Price |
|---|---|
| Run start | USD 0.003 |
| Text item processed (up to 1 MB) | USD 0.0002 |
| File processed (first MB included) | USD 0.0008 |
| Each extra MB of a file (larger of bytes read and written, rounded up), or of a text item's result over 1 MB | USD 0.00015 |
| Item failed after work was done (file downloaded but unreadable, or timeout) | USD 0.0002 |

Free rows: input errors, bad addresses, private addresses, 404 and refused files, files refused for size before download, an item that ran out of time while waiting for another conversion. Worked example: 200 texts plus 10 files of 3 MB = USD 0.003 + 200 x 0.0002 + 10 x (0.0008 + 2 x 0.00015) = USD 0.054. A text item is one event unless its result passes 1 MB (URL-encoding 900 KB of accented text gives 2.7 MB: `text-item` + 2 extra MB). The run stops cleanly before your maximum cost per run is reached, keeping the rows already saved (a platform test with a USD 0.01 limit stopped at USD 0.0099 with all 33 rows kept).

### Conversion details

- CSV: RFC 4180 quoting, line breaks inside cells, BOM, comma / semicolon / tab / pipe detected automatically, spaces before a quote, ragged rows (padded and counted in `warnings`), duplicate or empty headers renamed. Files that are not UTF-8 are read as Windows-1252.
- "Turn numbers and true/false into JSON values" is on by default for JSON, JSONL, YAML and XLSX results: `42`, `3.14`, `1.50` (as 1.5) and `true` become values; `007`, `+1`, `1e5`, `12.5%`, `-0` and any number that would not survive exactly (IDs over 2^53, a 30-digit decimal) stay text. CSV, TSV and XML results always keep every value exactly as written. Turn the option off to keep every value as text.
- JSON and YAML integers too large for a JavaScript number (IDs over 2^53) keep every digit in every output; in XLSX they are written as text, because an Excel number holds 15 digits.
- Nested JSON, YAML or XML records become columns like `address.city` in CSV, TSV and XLSX; lists stay JSON text in their cell. To JSONL each record is written whole, one per line. Pick the list of records with `recordPath` if the automatic choice is wrong.
- XLSX: first sheet, a named or numbered sheet, or all sheets (JSON: one key per sheet; CSV: one file per sheet). Cell values are the last calculated values, as stored: a cell shown as `12.5%` gives 0.125, a currency cell gives the plain number; dates become `2026-01-15` or `2026-01-15T13:45:30` (a spreadsheet date has no time zone). Output XLSX has no styles; text starting with `=` stays text, never a formula. A workbook is unpacked and measured before it is read: one that unpacks to more than 160 MB, or whose ZIP sizes do not match its contents, is refused.
- XML: attributes become `@name`, text beside attributes `#text`, repeated elements a list. Character references (`&#233;`) are decoded; entities declared in a DOCTYPE are never expanded and external entities are never loaded. Comments, processing instructions and the order of mixed text and elements are not kept.
- YAML: plain YAML only (no custom tags such as `!!python/object` or `!!binary`; a document with one is refused), duplicate keys are an error, anchors, aliases and merge keys (`<<: *base`) are read (a docker-compose file with 114 merge keys converts), a document that expands past the result size limit through its aliases is refused, several documents give a list.
- CSV formula guard (option): text cells starting with `= + - @` get a single quote in front so spreadsheet programs do not run them. Cells that are only a number (`-3`, `+1.5`) are not touched.
- Column order is kept when converting from a table, also for names like `1958`.

### Limits (honest)

- Texts: 1 MB each. Files: 25 MB by default (`maxFileMb`, up to 100 MB). The result may not be larger than the file size limit either, so Base64 encoding takes files up to 3/4 of the limit (18.7 MB at 25 MB) and hex up to half; a larger file is refused before it is read when the server states its size. Conversions hold the whole table in memory and stop at 20 MB of input (an XLSX of 17 MB gave a JSON result over 25 MB with indentation on; set indent 0 or a larger limit).
- One conversion runs at a time inside a run (memory), so many large conversions in one run are slower than many small ones.
- Files are fetched exactly as given with the user agent `UsefulApiBot/1.0 (+https://apify.com/usefulapi)`, at most 2 at a time from one host; only ports 80, 443, 8080 and 8443; no links with a user name or password; no private addresses. A server that refuses bots gives `blocked`. TLS certificates are verified.
- XLSX (.xlsx) only; old .xls, .ods and PDF are refused with a clear message (for PDF tables use `apify.com/usefulapi/pdf-text-ocr`).
- Decimal numbers with more than 17 significant digits are rounded when read from JSON (integers keep every digit); merged cells give their value in the top-left cell only; macros and charts are ignored.
- Saved files keep their real name and extension, but a type a browser would run or show as a page (HTML, SVG, XML) is stored as plain text.
- Reading records from your own key-value stores is not offered: Apify did not give the Actor access to a store named in the input in a test run. Use the record's URL (with its signature) in `fileUrls`.

### FAQ

**Is the HMAC key safe?** The input field is a secret field (encrypted by Apify). The Actor keeps the key only in memory, never writes it to a result, the summary or the log, and the saved files never contain it.

**What does a failed item cost?** Input errors cost nothing. A file that downloaded but could not be read or converted, or an item that hit its time limit, costs USD 0.0002.

**Why is the start price higher than other Base64 Actors?** It pays for the worst case of one file that hangs until its time limit (about 23 seconds of server time in a 1-file run). For bulk work it hardly matters: 1,000 texts cost USD 0.203. A run of 3 texts costs USD 0.0036.

**Related Actors** (usefulapi): `apify.com/usefulapi/bulk-file-downloader` (download files), `apify.com/usefulapi/pdf-text-ocr` (PDF text and tables).

# Actor input Schema

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

What to do with every item. Base64, Base64URL, hex and data URI encode and decode; hash (MD5, SHA-1, SHA-256, SHA-512, SHA3-256, CRC32); hmac (needs the HMAC key); URL and HTML entity encode and decode; convert (CSV, TSV, JSON, JSONL, XLSX, XML, YAML into each other, needs Convert to). An item in the Mixed items list can set its own operation.

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

One text per entry, up to 1 MB each. Billed per text.

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

One http or https address per line. Any file, up to the file size limit. Billed per file, first MB included. Addresses are fetched as given (a direct link to the file). A record of one of your key-value stores works too: use its record URL (with a signature, or a public store).

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

For items that need their own settings. Each entry is an object with "text", "url" or "kvKey", and optionally "operation", "targetFormat", "sourceFormat", "algorithms", "name", "mimeType", "sheets", "recordPath". Example: {"url": "https://example.com/data.xlsx", "operation": "convert", "targetFormat": "json"}.

## `targetFormat` (type: `string`):

For the convert operation: the format to produce. XLSX is always saved as a file.

## `sourceFormat` (type: `string`):

Auto detects the format from the file contents, then its name and content type, then the text itself.

## `algorithms` (type: `array`):

For the hash operation: one or more of md5, sha1, sha256, sha512, sha3-256, crc32. All of them are computed for the same price. Default: sha256.

## `hmacKey` (type: `string`):

For the hmac operation. Stored encrypted by Apify, never written to the results, the summary or the log.

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

Hash used for HMAC.

## `hmacKeyEncoding` (type: `string`):

How the key text is read: as plain text (utf8), as hex digits, or as Base64.

## `digestEncoding` (type: `string`):

How the digest is written.

## `urlMode` (type: `string`):

component = encodeURIComponent (every reserved character), full = encodeURI (keeps : / ? # & =), form = application/x-www-form-urlencoded (space as +).

## `htmlMode` (type: `string`):

minimal = only & < > " ' ; named = named entities for non-ASCII letters (é); numeric = numeric references (é).

## `mimeType` (type: `string`):

For data-uri-encode: the mime type to put in the URI (for example image/png). Empty = detected from the content.

## `base64LineLength` (type: `integer`):

Break Base64 output into lines of this length (76 for MIME). 0 = one line.

## `base64UrlPadding` (type: `boolean`):

Keep = padding in Base64URL output (RFC 4648 section 5). Default: no padding.

## `hexUppercase` (type: `boolean`):

Write hex digits as A-F instead of a-f.

## `hasHeader` (type: `boolean`):

Tables (CSV, TSV, XLSX): the first row holds the column names.

## `inferTypes` (type: `boolean`):

For JSON, JSONL, YAML and XLSX results. When on, plain numbers and true/false from CSV, TSV and XML become numbers and booleans, but only when the number is exactly the value written (007, 1e5, 12.5% and IDs over 2^53 stay text). CSV, TSV and XML results always keep values as written. Off keeps every value as text.

## `sheets` (type: `string`):

first = the first sheet, all = every sheet (JSON gets one key per sheet, CSV one file per sheet), or a sheet name or number.

## `xlsxFormulas` (type: `string`):

values = the last calculated value of each cell, formulas = the formula text (=SUM(A1:A3)).

## `recordPath` (type: `string`):

Where the list of records is, for example results or feed.entry. Empty = found automatically.

## `flatten` (type: `string`):

dot = nested objects become columns like address.city (lists stay JSON text); json = each nested value is one JSON text cell.

## `csvDelimiter` (type: `string`):

auto, comma, semicolon, tab, pipe, or one character.

## `csvOutputDelimiter` (type: `string`):

For CSV output: comma (default), semicolon, tab or pipe. TSV output always uses tab.

## `csvFormulaGuard` (type: `boolean`):

Put a single quote in front of text cells that start with = + - @ so spreadsheet programs do not run them as formulas (CSV injection). Cells that are only a number (-3, +1.5) are not touched.

## `csvBom` (type: `boolean`):

Start CSV files with a UTF-8 byte order mark, which makes Excel read accents correctly.

## `csvLineEnding` (type: `string`):

crlf (RFC 4180) or lf.

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

Spaces per level in JSON and XML output. 0 = compact.

## `xmlRoot` (type: `string`):

Name of the outer element when the data has no single root. Default: root (rows for tables).

## `xmlItem` (type: `string`):

Name of each element of a list. Default: item (row for tables).

## `encoding` (type: `string`):

auto reads a byte order mark, an XML declaration, then UTF-8, then Windows-1252. Or name one: utf-8, utf-16le, windows-1252, iso-8859-1.

## `maxFileMb` (type: `integer`):

Files above this size are refused (status too_large). The result may not pass it either, so Base64 encoding takes files up to 3/4 of it and hex up to half. Conversions hold the whole table in memory and stop at 20 MB.

## `maxInputs` (type: `integer`):

Stop after this many items. Leave empty for all.

## `inlineMaxKb` (type: `integer`):

A text result of a file (Base64, hex, converted JSON or CSV) up to this size is put in the row's "result" field and no file is saved. Larger results, binary results and XLSX are saved as files with a link. 0 = always save a file.

## `alwaysSaveFile` (type: `boolean`):

Also save small text results as files.

## Actor input object example

```json
{
  "operation": "base64-encode",
  "texts": [
    "Hello, world!",
    "foobar"
  ],
  "sourceFormat": "auto",
  "algorithms": [
    "sha256"
  ],
  "hmacAlgorithm": "sha256",
  "hmacKeyEncoding": "utf8",
  "digestEncoding": "hex",
  "urlMode": "component",
  "htmlMode": "minimal",
  "base64LineLength": 0,
  "base64UrlPadding": false,
  "hexUppercase": false,
  "hasHeader": true,
  "inferTypes": true,
  "sheets": "first",
  "xlsxFormulas": "values",
  "flatten": "dot",
  "csvDelimiter": "auto",
  "csvOutputDelimiter": ",",
  "csvFormulaGuard": false,
  "csvBom": false,
  "csvLineEnding": "crlf",
  "jsonIndent": 2,
  "encoding": "auto",
  "maxFileMb": 25,
  "inlineMaxKb": 256,
  "alwaysSaveFile": false
}
```

# Actor output Schema

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

No description

## `summary` (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, world!",
        "foobar"
    ],
    "algorithms": [
        "sha256"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("usefulapi/data-converter").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, world!",
        "foobar",
    ],
    "algorithms": ["sha256"],
}

# Run the Actor and wait for it to finish
run = client.actor("usefulapi/data-converter").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, world!",
    "foobar"
  ],
  "algorithms": [
    "sha256"
  ]
}' |
apify call usefulapi/data-converter --silent --output-dataset

```

## MCP server setup

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

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/hRCY9RutwTldnnbpx/builds/TNrcGt0oivDJsgNvo/openapi.json
