Encoding Utilities

Hex Encode

Converts plain text strings into hexadecimal representation using UTF-8 encoding. Access via MCP in Cursor or Windsurf, or call GET /v1/encode/hex/encode directly. Example: "hello" becomes "68656c6c6f". Each byte maps to two hex characters, making it useful for data transmission and debugging binary content in AI workflows.

API Endpoint

GET /v1/encode/hex/encode

Code Examples

curl "https://tinyfn.io/v1/encode/hex/encode" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/encode/hex/encode', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/encode/hex/encode',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's encoding tools:

{
  "mcpServers": {
    "tinyfn-encoding": {
      "url": "https://tinyfn.io/mcp/encoding",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does hex encoding work with Unicode characters?

Uses UTF-8 encoding first, then converts each byte to hex. A character like 'é' becomes 'c3a9' (two bytes in UTF-8).

What's the difference between hex encoding and Base64?

Hex uses 0-9 and a-f characters with 2:1 expansion ratio, while Base64 uses 64 characters with ~4:3 ratio. Hex is more readable but less efficient.

Can I use this MCP tool to encode binary data for AI agents?

Yes, hex encoding is perfect for representing binary data as text that AI models can process without corruption or interpretation issues.

How do I decode hex back to original text?

Use the corresponding hex decode tool or reverse the process: convert hex pairs back to bytes, then decode UTF-8 to get original text.

What happens with empty strings or whitespace?

Empty string returns empty hex. Spaces and newlines encode normally: space becomes '20', newline becomes '0a'.

Try Hex Encode Now

Get your free API key and start using Hex Encode in seconds.

Get Free API Key