Skip to content
POST AI agent ready /v1/base64/encode

Base64 Encode API - Convert Text to Base64

Convert any UTF-8 text into its Base64 representation. Choose standard or URL-safe encoding depending on your use case. URL-safe mode replaces + with - and / with _, making the output safe for query strings and file names.

Parameters

stringrequired

The UTF-8 string to encode.

boolean

Use URL-safe Base64 encoding (replaces + with - and / with _).

Code examples

curl -X POST https://api.botoi.com/v1/base64/encode \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello, World!","urlSafe":false}'

When to use this API

Embed binary data in JSON payloads

Base64-encode file contents, images, or certificates so they can travel inside JSON without escaping issues.

Build data URIs for inline assets

Encode SVG icons or small images to Base64 for embedding directly in HTML or CSS, cutting an extra network request.

Pass tokens in URL parameters

URL-safe Base64 encoding lets you include tokens or signed payloads in query strings without percent-encoding.

Frequently asked questions

What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / characters, which need percent-encoding in URLs. URL-safe Base64 replaces them with - and _, so the output can go directly into query strings or file names.
Is there a size limit on the input string?
The API accepts request bodies up to 1 MB. For larger payloads, encode on the client side.
Does this API handle non-ASCII characters like emoji?
Yes. The input is treated as UTF-8, so characters like emoji, CJK, and accented letters encode correctly.
Is Base64 encoding the same as encryption?
No. Base64 is a reversible encoding, not encryption. Anyone can decode the output. Use the /v1/encrypt/encrypt endpoint if you need confidentiality.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.