Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
Encode text to Base64, decode Base64 back to text, or turn Base64 image data back into the image file.
Operations
- encode: UTF-8 text to Base64. Send the text in
text(up to 100,000 characters). - decode: Base64 to UTF-8 text. Send the Base64 in
data(up to 150,000 characters). - decode-image: Base64 image data to the image file. Send the Base64 in
data(up to about 10 MB of image). The response body is the image itself, not JSON.
Notes
- Only standard Base64 is accepted (A-Z, a-z, 0-9, + and /). URL-safe Base64 that uses - and _ must be converted first. Whitespace in the input is ignored.
- Text is converted to UTF-8 before encoding, so accented letters, non-Latin scripts and emoji round-trip. Decoding fails with a 400 if the bytes are not valid UTF-8.
- For
decode-image,datacan be raw Base64 or a data URL such asdata:image/png;base64,.... The type is detected from the file contents and must be PNG, JPEG, GIF, WebP or BMP, and it is returned in theContent-Typeheader. - Encoding an image file is not offered here, because this endpoint takes JSON. Read the file bytes and Base64 them in your own code.
- Base64 is an encoding, not encryption.
Endpoints
POST
https://opentools.ca/api/v1/tools/base64-encoder-decoderEncode text, decode text, or decode a Base64 image
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| operation | string Enum: encode, decode, decode-image | Required | The operation to perform |
| text | string | Optional | Text to encode, 1-100,000 characters. Required for "encode". |
| data | string | Optional | Base64 string to decode. Required for "decode" (up to 150,000 characters) and "decode-image" (up to 14,000,000 characters). |
Response Example
{
"success": true,
"operation": "encode",
"encoded": "SGVsbG8sIFdvcmxkIQ==",
"length": 20
}Error Codes
400
Bad Request - Missing or oversized input, invalid Base64, invalid UTF-8, or data that is not a supported image401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
# Encode text
curl -X POST https://opentools.ca/api/v1/tools/base64-encoder-decoder \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operation": "encode", "text": "Hello, World!"}'
# Decode text
curl -X POST https://opentools.ca/api/v1/tools/base64-encoder-decoder \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operation": "decode", "data": "SGVsbG8sIFdvcmxkIQ=="}'
# Decode an image and save it
curl -X POST https://opentools.ca/api/v1/tools/base64-encoder-decoder \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operation": "decode-image", "data": "iVBORw0KGgo..."}' \
-o decoded-image.pngRather use it in your browser? Open the Base64 Encoder/Decoder
