Snipget.ai

Encoding hex

Exact
encoding_hex

Deterministic and authoritative — the canonical answer for this input.

Hex encode or decode text. mode='encode' turns UTF-8 bytes into lowercase hex; 'decode' expects valid hex resolving to UTF-8 text. Processing multiple inputs? Use `encoding_hex_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

Text to hex-encode, or hex to decode.

modestringoptional

'encode' or 'decode'.

Call it

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

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

Example response

{
  "input": "hi",
  "is_valid": true,
  "mode": "encode",
  "output": "6869"
}

FAQ

What does hex encoding do for me?

It turns text into its hexadecimal byte representation (and back), which is a common way to show or transport data in logs, debugging tools, and configuration. Doing it by hand is error-prone; this gives the exact bytes every time.

Can it go both ways?

Yes. Set mode to 'encode' to turn text into hex, or 'decode' to turn hex back into text. Decoding expects the bytes to form readable UTF-8 text.

Does spacing in the hex matter when decoding?

No. Spaces are ignored on decode, so '68 69' and '6869' both work. The output is always lowercase hex when encoding.

What if the hex is malformed?

Invalid hex (an odd number of digits, or characters outside 0-9 and a-f) comes back with is_valid false, confidence 0, and a why_invalid reason, not an error.

Will I always get the same answer?

Yes. Hex encoding is exact and deterministic, so the same input always produces the same canonical output.

Related tools