Transform utilities - Encoding

Encoding APIs

Encode and decode bytes as Base64, base64url, hex, Base58 and Base32, and text as URL percent-encoding and HTML entities. Send JSON or the raw body. The byte decoders answer the raw bytes or a typed JSON response, chosen by the Accept header.

  • No API key
  • Fourteen endpoints
  • Raw byte output
  • Optional JSON output

Encode or decode

POST/{encoding}_encode

POST/{encoding}_decode

https://aisenseapi.com/services/v1

Base64 encode and decode

# Encode
curl -X POST https://aisenseapi.com/services/v1/base64_encode \
  -H "Content-Type: application/json" \
  -d '{"data":"Hello world"}'

{ "base64_encoded_data": "SGVsbG8gd29ybGQ=" }
# Decode as raw bytes
curl -X POST https://aisenseapi.com/services/v1/base64_decode \
  -H "Content-Type: application/json" \
  -d '{"data":"SGVsbG8gd29ybGQ="}'

Hello world

Base58 encode and decode

Base58 avoids characters that are easy to confuse in print. It is often used for compact identifiers and blockchain-related formats.

{ "data": "Hello" }

{ "base58_encoded_data": "9Ajdvzr" }

Send 9Ajdvzr to /base58_decode to get the original bytes. An invalid Base58 character returns HTTP 400 with {"error":"Invalid Base58 input."}.

Base32 encode and decode

Base32 uses a smaller, case-insensitive alphabet that works well in systems where mixed case or punctuation is inconvenient.

{ "data": "Hello" }

{ "base32_encoded_data": "JBSWY3DP" }

Send JBSWY3DP to /base32_decode to retrieve Hello.

Hex encode and decode

Hex writes every byte as two digits, the way hashes, keys and device payloads are usually shown. The decoder takes either case, a leading 0x and spaces.

{ "data": "hello" }

{ "hex_encoded_data": "68656c6c6f" }

Send 68656C6C6F to /hex_decode to get hello back. See the hex encode and hex decode pages.

base64url encode and decode

base64url is Base64 with - and _ for + and / and no padding, the form JWT, OAuth PKCE and WebAuthn use. It goes into a URL or a file name as it is.

{ "data": "hello?" }

{ "base64url_encoded_data": "aGVsbG8_" }

/base64url_decode takes it with or without padding and answers 400, with a pointer to /base64_decode, for a + or /. See the encode and decode pages.

URL encode and decode

Percent-encoding for one path segment or query value (RFC 3986): every byte but A-Z a-z 0-9 - _ . ~ becomes %XX, so a space is %20.

{ "data": "a b/c?é" }

{ "url_encoded_data": "a%20b%2Fc%3F%C3%A9" }

/url_decode answers {"url_decoded_data": "..."} and leaves a + as it is. See the encode and decode pages.

HTML encode and decode

& < > " ' become entities, so text can go into a page or an attribute as it is, and every named or numeric entity comes back as its character.

{ "data": "<b>Tom & Jerry</b>" }

{ "html_encoded_data": "&lt;b&gt;Tom &amp; Jerry&lt;/b&gt;" }

See the encode and decode pages.

Choose raw bytes or JSON

The five byte decoders, Base64, base64url, hex, Base58 and Base32, return application/octet-stream when no Accept header is sent. This is useful for files and binary data. /url_decode and /html_decode answer JSON, since their result is text.

Send Accept: application/json when a JSON client needs a predictable envelope:

{
  "type": "json",
  "decoded_data": { "key": "value" }
}

When the decoded bytes are not JSON, the response uses type: binary and returns the data as Base64 inside decoded_data.

Endpoint reference

EndpointJSON response key
/base64_encodebase64_encoded_data
/base58_encodebase58_encoded_data
/base32_encodebase32_encoded_data
/base64_decodeRaw bytes or type and decoded_data
/base58_decodeRaw bytes or type and decoded_data
/base32_decodeRaw bytes or type and decoded_data
/hex_encodehex_encoded_data
/hex_decodeRaw bytes or type and decoded_data
/base64url_encodebase64url_encoded_data
/base64url_decodeRaw bytes or type and decoded_data
/url_encodeurl_encoded_data
/url_decodeurl_decoded_data
/html_encodehtml_encoded_data
/html_decodehtml_decoded_data

Encoding is not encryption

None of these encodings protects data. Anyone can decode the value. Do not use an encoding as a security control.

Use these endpoints when data needs a transport-safe representation. Calculate the encoding locally when the input is confidential.