Base64 encoder | Encode Data Effortlessly
Convert text and binary data to Base64 with our online encoder. It supports text, images, and files. Paste data or upload files for Base64 output, suitable for HTML, CSS, or data storage.
0 bytes
Any file type (max size: 10MB). Everything runs in your browser.
Uses - and _ instead of + and / and drops padding (=). Use for URLs, filenames and JWTs.
0 bytes
How to Use the Base64 Encoder & Decoder
- Choose Encode or Decode, then pick Text or File as your input.
- Type or paste your text, or select a file, and tweak the URL-safe option if needed.
- Click the action button to get your result instantly.
- Copy the output, download it as a file, or click Clear to start over.
Your data never leaves your device. All encoding and decoding happens locally in your browser.
Use this tool from your AI agent
Free JSON API and Model Context Protocol (MCP) server. No signup, no API key, CORS open. Designed for Claude, ChatGPT, Cursor, scripts and frontend apps.
curl -X POST https://mate.tools/api/v1/base64-encode.php \
-H "Content-Type: application/json" \
-d '{"text":"hello world","url_safe":false}' import urllib.request, json
req = urllib.request.Request(
"https://mate.tools/api/v1/base64-encode.php",
data=json.dumps({"text":"hello world","url_safe":false}).encode(),
headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as r:
print(json.load(r)) const r = await fetch("https://mate.tools/api/v1/base64-encode.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({"text":"hello world","url_safe":false}),
});
console.log(await r.json()); Add to claude_desktop_config.json (Claude Desktop), ~/.cursor/mcp.json (Cursor), or any other MCP-compatible client:
{
"mcpServers": {
"mate-tools": {
"command": "npx",
"args": ["-y", "@mate-tools/mcp-server"]
}
}
} Related Tools
Frequently Asked Questions
Base64 encoding converts binary or text data into ASCII text using a 64-character alphabet (A–Z, a–z, 0–9, + and /). It lets binary data travel safely through systems that can only handle text, such as email, JSON or URLs. It is encoding for transport, not encryption, so it provides no security.
Switch to Decode mode, paste your Base64 string (or load a .txt file containing it), and click Decode. Readable text appears in the result box, and you can use Download to save the decoded data as a file, which is handy for images, PDFs and other binary content.
Choose Encode, switch the source to File, and select your image. The tool outputs both the raw Base64 string and a ready-to-use data URI (data:image/png;base64,...). Paste the data URI into an HTML img src or a CSS background-image to embed the image without a separate file.
URL-safe Base64 replaces + with - and / with _ and removes the = padding, so the result is safe to put in URLs, query strings, filenames and JSON Web Tokens (JWTs). Enable the URL-safe switch when your output needs to be passed in a URL or filename.
Yes. Base64 turns every 3 bytes of data into 4 ASCII characters, so the encoded output is about 33% larger than the original. That overhead is the trade-off for making binary data safe to transport as plain text.
Nothing is uploaded. All encoding and decoding runs entirely in your browser using JavaScript, so your text and files never leave your device. The tool also handles full UTF-8 text correctly, including emoji and accented characters.
What Is a Base64 Encoder?
A Base64 encoder converts text, images or files into a plain-text Base64 string using a 64-character alphabet (A–Z, a–z, 0–9, + and /). This lets binary data travel safely through systems that only handle text. This tool also decodes Base64 back to text or a downloadable file, supports UTF-8 and a URL-safe variant, and runs entirely in your browser.