Free Base64 API

Encode, decode and validate Base64 from scripts, no-code tools and AI agents. JSON in, JSON out. No key and no sign-up.

Limits: 1024 KB per request and 120 requests per minute per IP address. For bigger files use the website - it has no size limit because it works in your browser. Machine-readable description: openapi.yaml.

Encode text

POST /api/v1/encode

FieldMeaning
textThe text to encode (required)
charsetUTF-8 (default), UTF-16LE, UTF-16BE, ISO-8859-1, windows-874 (Thai), US-ASCII
urlSafetrue = Base64URL alphabet (- and _)
paddingfalse = leave out the = signs
lineLengthLine breaks every n characters, e.g. 76 for MIME (default 0 = one line)
curl -s -X POST http://103.76.183.74:8106/api/v1/encode \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello world"}'
{ "base64": "SGVsbG8gd29ybGQ=", "inputBytes": 11, "outputLength": 16, "charset": "UTF-8" }

Decode

POST /api/v1/decode with {"data": "..."} - Base64, Base64URL or a data URI; whitespace and missing padding are fine.

{ "isText": true, "text": "Hello world", "bytes": 11, "mediaType": "text/plain", "urlSafeInput": false, "charset": "UTF-8" }

When the data is a file, isText is false and mediaType tells what it is (for example application/pdf).

Validate

POST /api/v1/validate with {"data": "..."} returns whether the string is valid, the alphabet, the decoded size, the detected type and a list of problems with their positions.

JavaScript

const r = await fetch("http://103.76.183.74:8106/api/v1/decode", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ data: "SGVsbG8gd29ybGQ=" })
});
console.log((await r.json()).text); // Hello world

Python

import requests
r = requests.post("http://103.76.183.74:8106/api/v1/encode", json={"text": "Hello world", "urlSafe": True})
print(r.json()["base64"])

Errors

Errors return {"code": "...", "message": "..."} with HTTP 400 (bad request), 413 (too large), 422 (invalid Base64) or 429 (too many requests - wait for the number of seconds in the Retry-After header).

Converting in your own code is easy too - see Base64 in every language.

Ad