#️⃣

Base64 Encode

Encode strings to standard or URL-safe Base64.

POST 1 credit /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
Response 200 OK
{
  "encoded": "SGVsbG8sIFdvcmxkIQ==",
  "encoding": "base64"
}

Try It Live

Live Demo

Description

Encode strings to standard or URL-safe Base64.

How to Use

1

1. Set the `input` field to the string you want to encode.

2

2. Optionally set `url_safe` to `true` for URL-safe Base64 encoding.

3

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

Frequently Asked Questions

What's the difference between standard and URL-safe Base64?
Standard Base64 uses `+`, `/`, and `=` characters, which have special meaning in URLs. URL-safe Base64 replaces `+` with `-` and `/` with `_`, making the output safe for use in URLs, filenames, and cookies.
Does Base64 provide any security?
No. Base64 is an encoding, not encryption. Anyone can decode a Base64 string. Use encryption endpoints if you need to protect data confidentiality.
How much larger is Base64 output?
Base64 encoding increases data size by approximately 33% — every 3 bytes of input become 4 characters of output.

Start using Base64 Encode now

Get your free API key and make your first request in under a minute.