Multi-Format Encoder
Encode or decode strings using Base64, URL, HTML entities, hex, or ASCII85.
/v1/auth/encode
curl -X POST "https://auth.toolkitapi.io/v1/auth/encode" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "Hello, World! <script>alert(1)</script>",
"encoding": "html_entities",
"decode": false
}'
import httpx
resp = httpx.post(
"https://auth.toolkitapi.io/v1/auth/encode",
json={
"data": "Hello, World! <script>alert(1)</script>",
"encoding": "html_entities",
"decode": false
},
)
print(resp.json())
const resp = await fetch("https://auth.toolkitapi.io/v1/auth/encode", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"data": "Hello, World! <script>alert(1)</script>",
"encoding": "html_entities",
"decode": false
}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"encoding": "html_entities",
"mode": "encode",
"result": "Hello, World! <script>alert(1)</script>"
}
Try It Live
Description
How to Use
1. Set the `data` field to the string you want to encode or decode.
2. Choose an `encoding` format: `base64`, `base64url`, `url`, `html_entities`, `hex`, or `ascii85`.
3. Set `decode` to `true` if you want to reverse the encoding. Default is `false` (encode).
4. Send a POST request and use the `result` from the response.
About This Tool
The Multi-Format Encoder is a versatile endpoint that handles encoding and decoding across six different formats: Base64, Base64 URL-safe, URL encoding, HTML entities, hexadecimal, and ASCII85. A single endpoint replaces the need for multiple encoding utilities.
Set the `decode` flag to `true` to reverse any encoding. This makes it a bidirectional tool — encode data before storage or transmission, then decode it when you need the original value back.
This endpoint is particularly useful for sanitizing user input (HTML entities), preparing data for URLs (URL encoding), or converting between binary representations (hex, ASCII85).
Why Use This Tool
- HTML sanitization — Encode user input as HTML entities to prevent XSS attacks
- URL encoding — Percent-encode strings for safe use in URLs and query parameters
- Hex conversion — Convert strings to hexadecimal for debugging or binary protocols
- ASCII85 encoding — Compact encoding for binary data (used in PDF, PostScript)
- Format conversion — Convert between different encoding formats in a pipeline
- Data inspection — Decode encoded strings during development and debugging
Frequently Asked Questions
When should I use this versus the dedicated Base64 endpoints?
What is ASCII85 encoding?
Is URL encoding the same as percent-encoding?
Can I chain multiple encodings?
Start using Multi-Format Encoder now
Get your free API key and make your first request in under a minute.