Yo! Base64 Encode logoYo! Base64 Encode
HomeAPI

Base64 Encode API

A free REST endpoint that encodes text to Base64. Send a POST with a JSON body, get the Base64 result back as plain text. No API key, no sign-up.

Endpoint

HTTP
POST https://yobase64encode.com/api/encode
Content-Type: application/json

No API key or authentication is required. The endpoint returns standard Base64 (the +/ alphabet); if you need URL-safe output, transform it yourself. CORS is open, so you can call it from the browser. For non-UTF-8 input, pass encoding explicitly.

Request parameters

JSON body fields:

FieldTypeRequiredDescription
inputstringYesThe text to encode to Base64.
encodingstringNoInput character set, e.g. UTF-8, ASCII. Defaults to auto-detect (UTF-8).

Response

On success, 200 OK with the Base64 string as text/plain. On failure, a JSON object with an error field (see Errors).

HTTP
POST /api/encode  {"input":"Hello, World!"}

200 OK  text/plain
SGVsbG8sIFdvcmxkIQ==

Rate limits & size

  • 10 requests per minute per IP address. Over the limit returns 429.
  • 1 MB maximum input size. Larger payloads return 400.

Examples

cURL

bash
curl -X POST https://yobase64encode.com/api/encode \
  -H "Content-Type: application/json" \
  -d '{"input": "Hello, World!", "encoding": "UTF-8"}'

JavaScript

javascript
const res = await fetch("https://yobase64encode.com/api/encode", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ input: "Hello, World!" }),
});
console.log(await res.text()); // SGVsbG8sIFdvcmxkIQ==

Python

python
import requests

r = requests.post(
    "https://yobase64encode.com/api/encode",
    json={"input": "Hello, World!"},
)
print(r.text)  # SGVsbG8sIFdvcmxkIQ==

PHP

php
<?php
$ch = curl_init("https://yobase64encode.com/api/encode");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["input" => "Hello, World!"]));
echo curl_exec($ch);

Go

go
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    body := bytes.NewBufferString(`{"input":"Hello, World!"}`)
    resp, _ := http.Post("https://yobase64encode.com/api/encode", "application/json", body)
    defer resp.Body.Close()
    out, _ := io.ReadAll(resp.Body)
    fmt.Println(string(out)) // SGVsbG8sIFdvcmxkIQ==
}

Errors

StatusWhen
400Missing input or input over 1 MB.
405A method other than POST was used.
429Rate limit exceeded (more than 10 requests/minute).

Errors return JSON (not plain text), so branch on the status code:

json
{ "error": "Invalid input" }