Snipget.ai

Base64 encode or decode

Exact
encoding_base64

Deterministic and authoritative — the canonical answer for this input.

Base64 encode or decode UTF-8 text. mode='encode' or 'decode'; url_safe uses the URL/filename-safe alphabet (-_ for +/). Decoding malformed input returns confidence 0.0, not an error. Processing multiple inputs? Use `encoding_base64_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

Text to encode, or base64 to decode.

modestringoptional

'encode' or 'decode'.

url_safebooleanoptional

Use the URL/filename-safe alphabet (-_ for +/).

Call it

curl -X POST https://api.snipget.ai/v1/encoding/base64 \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"hello world","mode":"encode"}'

The Batch tab sends up to 1000 inputs in one call via /v1/encoding/base64/batch.

Example response

{
  "input": "hello world",
  "is_valid": true,
  "mode": "encode",
  "output": "aGVsbG8gd29ybGQ=",
  "url_safe": false
}

FAQ

Why use this instead of asking the model to encode it?

Base64 is an exact, character-by-character transform where a single wrong letter breaks the whole string. This runs the real encoder, so the output is always correct and the same every time, which a language model guessing by hand can't promise.

Does it both encode and decode?

Yes. Set mode to 'encode' to turn text into base64, or 'decode' to turn base64 back into text. Decoding expects the result to be readable UTF-8 text, not raw binary like an image.

What is the url_safe option for?

Standard base64 uses the characters + and /, which have special meaning inside web links. Turn on url_safe to use - and _ instead, so the result is safe to drop into a URL.

What happens if I try to decode something that isn't valid base64?

You don't get an error. The result comes back with is_valid set to false, confidence 0, and a why_invalid reason explaining what was wrong, so you can spot the bad input.

Is the result reliable enough to trust?

Yes. This is an exact, deterministic operation, so the answer is the canonical one and never changes between calls for the same input.

Related tools