Upload a file
  1. base64hub
  2. Download
  3. HTTP API
v1.0.0 · Open source · MIT

Free Base64 API: Encode, Decode and Validate over HTTPS

https://api.base64hub.com/v1 encodes, decodes and validates Base64 over plain HTTPS. No sign-up, no key, JSON in and out, and CORS so it works from a browser too.

Free no account, no key MIT open source license Zero runtime dependencies Updated Nov 22, 2026

Endpoints

MethodPathWhat it does
POST/v1/encodetext or raw bytes to Base64; standard or URL-safe, padding, line wrap
POST/v1/decodeBase64 to text, hex for binary, or the raw bytes
POST/v1/validateis it Base64, which alphabet, padded, how many bytes
GET/v1/healthstatus and version
GET/v1/openapi.jsonthe OpenAPI 3.1 description

Requests and responses are JSON. Encode also takes raw bytes as application/octet-stream, and decode can return raw bytes when you ask for them with Accept: application/octet-stream.

A request and its response

Encode a string as URL-safe Base64 without padding:

curl -s https://api.base64hub.com/v1/encode \
  -H 'Content-Type: application/json' \
  -d '{"input": "Привет", "variant": "url", "padding": false}'
{"output":"0J_RgNC40LLQtdGC","variant":"url","padding":false,"bytes_in":12,"bytes_out":16}

Decode works the same way, and tells you when the bytes are not text:

curl -s https://api.base64hub.com/v1/decode \
  -H 'Content-Type: text/plain' -d '+/+/'
{"output":null,"utf8":false,"hex":"fbffbf","bytes_out":3}

The decoder is lenient on purpose: spaces and line breaks, a data:...;base64, prefix, missing padding and either alphabet are accepted. Real errors come back as 400 invalid_base64 with the bad character and its position, for example invalid character '!' at position 4.

Limits and behavior

  • Authentication: none, no key or token.
  • Rate limit: 20 requests per 10 seconds per IP address. Over the limit you get status 429 from Cloudflare.
  • Body size: up to 1 MB. Larger bodies get 413 too_large.
  • Strict inputs: unknown JSON fields and query parameters are rejected with 400 invalid_body, so a typo in an option name never goes unnoticed.
  • CORS: Access-Control-Allow-Origin: * on every response, preflight answered.
  • Caching: every response is Cache-Control: no-store.

The API overview has the full error table and the rules for each content type.

When to use an API for Base64

Base64 is cheap to compute, and every language has it built in: btoa in browsers, Buffer in Node.js, the base64 module in Python. Calling a web service for it makes sense when:

  • you are in a no-code tool, a spreadsheet or a webhook builder that can make HTTP requests but cannot run code;
  • you want the same lenient decoding and validation in every language without porting it;
  • you are testing or teaching and want a reference answer to compare against.

For anything sensitive, such as tokens or private keys, prefer a local tool: the browser tools on this site, the CLI or the npm and Python packages give identical results without the data leaving your machine.

FAQ

Is the base64hub API really free?

Yes. There is no key and no account. A rate limit of 20 requests per 10 seconds per IP address keeps it available for everyone.

Does the API store what I send?

No. It runs as a Cloudflare Worker with no storage and does not log request bodies. Still, do not send secrets to any web service when a local tool will do; the b64 CLI gives the same results offline.

Can I call the Base64 API from JavaScript in the browser?

Yes. Every response carries Access-Control-Allow-Origin: * and preflight requests are answered, so fetch() works from any origin.

How large a file can I encode with the API?

Request bodies are limited to 1 MB. For bigger files, use the CLI, which streams, or the File to Base64 tool in your browser.

More from base64hub