Base64 Encode
Encode strings to standard or URL-safe Base64.
/v1/auth/base64-encode
curl -X POST "https://auth.toolkitapi.io/v1/auth/base64-encode" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, World!",
"url_safe": false
}'
import httpx
resp = httpx.post(
"https://auth.toolkitapi.io/v1/auth/base64-encode",
json={
"input": "Hello, World!",
"url_safe": false
},
)
print(resp.json())
const resp = await fetch("https://auth.toolkitapi.io/v1/auth/base64-encode", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": "Hello, World!",
"url_safe": false
}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"encoded": "SGVsbG8sIFdvcmxkIQ==",
"encoding": "base64"
}
Try It Live
Description
How to Use
1. Set the `input` field to the string you want to encode.
2. Optionally set `url_safe` to `true` for URL-safe Base64 encoding.
3. Send a POST request and use the `encoded` value from the response.
About This Tool
The Base64 Encode endpoint converts a string into Base64 representation. It supports both standard Base64 (RFC 4648) and URL-safe Base64, which replaces `+` and `/` with `-` and `_` to make the output safe for URLs and filenames.
Base64 encoding is used wherever binary or special characters need to be represented as ASCII text — email attachments (MIME), data URIs, JWT payloads, API request bodies, and configuration files.
This endpoint handles the encoding and reports which encoding variant was used in the response.
Why Use This Tool
- Preparing data for JSON payloads — Encode binary data for safe transport in JSON
- Building data URIs — Create inline data URIs for images or files
- Email encoding — Encode attachments or headers for MIME messages
- URL parameter encoding — Use URL-safe Base64 for query parameters or path segments
- Configuration values — Encode secrets or binary config for environment variables
Frequently Asked Questions
What's the difference between standard and URL-safe Base64?
Does Base64 provide any security?
How much larger is Base64 output?
Start using Base64 Encode now
Get your free API key and make your first request in under a minute.